2

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?

Shai
  • 111,146
  • 38
  • 238
  • 371
smilingbuddha
  • 14,334
  • 33
  • 112
  • 189

1 Answers1

5

Use load(filename, '-ascii')

kol
  • 27,881
  • 12
  • 83
  • 120