Save Matlab figure without plotting it?

瘦欲@ 提交于 2019-12-05 18:30:00

问题


Is there a way of saving a figure plot without actually plotting it? I mean, let's say I want to save the graph for plot(1:10, (1:10).^2), can I save it without showing it?

I want to make the run time shorter by cutting off the unnecessary plotting of the figures (those will be closed anyway after saving).

Thanks!


回答1:


This can be done:

set(gcf,'Visible','off');
plot((1:10),(1:10).^2);
print -dpng c:\chris.png  % or whatever your print command is



回答2:


There is also the saveas(h,'filename.ext') function which can save a figure in some formats.



来源:https://stackoverflow.com/questions/5818469/save-matlab-figure-without-plotting-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!