loading multiple .mat files in MATLAB
- by smilingbuddha
I have 110 files named time1.mat, time2.mat ..., time110.mat. I want to load these matrices into the MATLAB workspace.
I have always used load -'ASCII' matrix.mat to load an ASCII matrix file in the current folder.
So I tried doing
for i=1:10
filename=strcat('time',int2str(i),'.mat');
load -'ASCII' filename
end
But I am getting a MATLAB error as
??? Error using ==> load
Unable to read file filename: No such file or directory.
?
Of course the string filename seems to be evaluated correctly by MATLAB as time1.mat. in the first iteration where it crashes at the load line.
Any suggestions how I should do this?