How to import multiple files in a for loop using sprintf or other
Show older comments
I'am trying to import text files which have similar names in which only a number changes:
node2_200.txt, node2_250.txt, node2_300.txt, and so on in increments of 50 (can be another amount)
what i tried was the following:
n = 9
A = 250
for i=1:n
formatSpec = 'node2_%d.out';
B1 = load(sprintf(formatSpec,A));
A = A+50
end
The problem here is that the result for B1 is just the last iteration and I need a variable for each of the "n" iterations. In other words I need "n" arrays made up of each specific text file.
Any ideas??
Accepted Answer
More Answers (0)
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!