uigetfile function error when one file selected!
Show older comments
can someone help me figure this one out?
I want to be able to browse for files and take the selected files in a loop like however i get an error "brace indexing not allowed" however, the code works if i select 2 or more files.
Brace indexing is not supported for variables of this type.
Error in m190507_model_vehicle_test_compare (line 45)
load(files_to_compare{i})
[files_to_compare,path] = uigetfile({'*.mat'},'MultiSelect','on');
for i = 1:1:length(files)
load(files{i})
Accepted Answer
More Answers (1)
Walter Roberson
on 13 May 2019
0 votes
This is normal. uigetfile only returns a cell array if more than one file was selected. You can use iscell or ischar to test. And watch out for nothing selected which returns a numeric scalar.
Also you used the wrong variable names between the lines
1 Comment
ramez sabra
on 13 May 2019
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!