how to save the figure?

i have some functions then i have
if true
figure(k)
end
each iteration i got one figure. now i want to save the every figure in a new directory. please help me

 Respuesta aceptada

Lisa Wu
Lisa Wu el 10 de Mayo de 2013

0 votos

num_of_fig = 1;
fichier=fullfile('directory','filename') ;
if true
figure(k);
name = strcat('figure',num2str(num_of_fig ));
% save figure name as figure1,figure2,figure3
saveas(gcf,strcat(name,'jpg'));
num_of_fig = num_of_fig +1;
end

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 10 de Mayo de 2013

0 votos

fichier=fullfile('directory','filename')
saveas(gcf,'fichier.jpg')

2 comentarios

win
win el 10 de Mayo de 2013
it saves only one figure. for eg., in the final output i got 10 output images via for loop. i got a figure in every iteration. and also i need to save all those 10 images. please help
Azzi Abdelmalek
Azzi Abdelmalek el 10 de Mayo de 2013
for k=1:10
fichier=fullfile('directory',sprintf('filename%d',k))
saveas(gcf,'fichier.jpg')

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Preguntada:

win
el 10 de Mayo de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by