How to import multiple files in a for loop using sprintf or other
Mostrar comentarios más antiguos
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??
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Variables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!