How to only have user select data file if workspace is empty?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a generic code that calculates things based off of the data file that the user selects and loads into the Matlab Workspace. Here is my code to do that:
%%Load Data
% Open Matlab file (ATI data)
[a,b]=uigetfile('*.mat');
FileATI=fullfile(b,a);
dataATI = load(FileATI);
I know there is some intrinsic function like "if isempty" that would prevent me from having to select the file every single time I re-run my code. How would I do this? Thanks so much, in advance!
0 件のコメント
採用された回答
dpb
2014 年 7 月 22 日
The term "generic" is iffy; but for the case as actually written/posted,
if ~exist('dataATI','var')
% load file stuff goes here
...
end
If any variables different in name are loaded then that's a problem, of course.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!