How to save a figure (subplot) through each run of a for loop

2 visualizaciones (últimos 30 días)
Riyadh Muttaleb
Riyadh Muttaleb el 26 de Abr. de 2016
Comentada: Azzi Abdelmalek el 26 de Abr. de 2016
I have loop (for i=1:10) and for each loop I have subplot consists from 15 figs (for each page). How can I save 10 pages of subplot?
Thanks
Riyadh

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 26 de Abr. de 2016
Use the command "figure" to create a new figure
  2 comentarios
Riyadh Muttaleb
Riyadh Muttaleb el 26 de Abr. de 2016
Thank you Azzi for your response. I used figure, but how can I save them separately.
Azzi Abdelmalek
Azzi Abdelmalek el 26 de Abr. de 2016
Look at this example
t=0:0.1:10;
for k=1:3
y=rand(size(t))
figure
h=plot(t,y)
hgsave(h,sprintf('fig%d',k))
end
Now use hgload to get your figures
close all % close your current figures
hgload('fig1')

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by