Need help for saveas function for saving multiple figures

조회 수: 7 (최근 30일)
Sarah
Sarah 2012년 4월 17일
댓글: Pradeep 2013년 11월 24일
Hey guys,
Need some help with the saveas function. How can I save multiple figures that are being generated by a for loop? For example, this is what I have so far:
for k = 1:10
figure(k);
plot(foo)
saveas(k,'???')
How can I change my string at every iteration? I need the string to be descriptive with respect to the content of the figure.

채택된 답변

Jessica Lam
Jessica Lam 2012년 4월 17일
should be saveas not save
saveas(gca,temp)
  댓글 수: 2
Jessica Lam
Jessica Lam 2012년 4월 17일
try that one again=)
hope it works
for k = 1:10 figure(k); plot(foo); temp=['fig',num2str(k),'.png']; saveas(gca,temp); end
Sarah
Sarah 2012년 4월 17일
yes! thank you :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jessica Lam
Jessica Lam 2012년 4월 17일
for k = 1:10 figure(k); plot(foo); temp=['fig',num2str(k),'.png']; save(gca,temp); end
  댓글 수: 3
Image Analyst
Image Analyst 2012년 4월 17일
See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
Pradeep
Pradeep 2013년 11월 24일
Use saveas in place of save
for k = 1:10 figure(k); plot(foo); temp=['fig',num2str(k),'.png']; saveas(gca,temp); end
The code worked for me and I think it should work for you too.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by