The following loop is giving me a warning of "The variable 'raw' appears to change size on every loop iteration (within a script). Consider preallocating for speed."
for Str = {'Red' 'Green' 'Orange' 'Purple' 'Pink'};folder = '';FileNames=dir('.xls');for i = length(FileNames) FileToLoad = FileNames(i).name; [~,~,raw{i}] = xlsread(FileToLoad); if exist(FileToLoad , 'file')==0 continue; endendreturn;end
Also, when the files are read into the 'raw' container they are not in the same order as they are listed in the Str. I want the files to be listed in raw table in the order that they are listed in the Str. Is this possible, as I use those indexes later on in my code.
Any suggestions are appreciated. Thanks
Best Answer