I want to read a bunch of files inside a loop function in MATLAB, but when I try the following code:

2 views (last 30 days)
Hamidreza on 29 Apr 2021
Commented: per isakson on 29 Apr 2021
j = (i * 2000000);
A = dlmread('gr_at_0.l_%d', j);
I get the following error:
Error using sprintf
Invalid format.
Error in dlmread (line 71)
delimiter = sprintf(delimiter); % Interpret \t (if necessary)
Error in RDF (line 15)
A = dlmread('gr_at_0.l_%d', j);
the following file is one of the many files that I want to read:
I would appreciate any comment.

Answers (1)

per isakson
per isakson on 29 Apr 2021
Edited: per isakson on 29 Apr 2021
What do you suppose that the following statement will do?
j = (i * 2000000);
A = dlmread('gr_at_0.l_%d', j);
A = dlmread(sprintf('gr_at_0.l_%d',j));

Community Treasure Hunt

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

Start Hunting!