Need help for saveas function for saving multiple figures

7 次查看(过去 30 天)
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

请先登录,再进行评论。

更多回答(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