How can I create multiple figures in a loop?
Mostrar comentarios más antiguos
I'm trying to plot graphs of the same variables from multiple files. The code below just gives me the same graph five times. How do I get the loop to plot a new figure for each different file?
files=dir('s*.mat');
for i=1:length(files)
load (files(i).name)
end
for i=1:length(files)
figure(i)
plot(data.time,data.s)
hold on
end
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 8 de Nov. de 2013
0 votos
Each time you are load()'ing a file, you are overwriting the previous "data" variable.
Categorías
Más información sobre Loops and Conditional Statements 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!