load ascii data with multiple name

1 view (last 30 days)
gugum gumbira
gugum gumbira on 13 Apr 2016
Edited: Stephen23 on 15 Apr 2016
dear all,
I have some data with name ZA000060.TXT, ZA000120.TXT, ZA000180.TXT ..... at the same time I load data with :
for k=60:60:300
aa = sprintf('%d',k);
load (['ZA0000' aa '.TXT'],'AAA')
but there is error when load second data because the zero number.
unable to read file "ZA0000120.TXT"
Any help would be great,
Best regard,
Stephen23 on 15 Apr 2016
You didn't replace the ellipses with the filename. Specify the filename and it will work.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 13 Apr 2016
for k=60:60:300
filename = sprintf('ZA000%03d.TXT', k);
ZA{K} = load(filename);

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!