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?

0

1 Answer 1

5

Use load(filename, '-ascii')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.