开发者

Save Matlab figure without plotting it?

开发者 https://www.devze.com 2023-03-01 12:35 出处:网络
Is there a way of saving a figure plot without actually plotting it? I mean, let\'s say I want to save the g开发者_如何学Craph for plot(1:10, (1:10).^2), can I save it without showing it?

Is there a way of saving a figure plot without actually plotting it? I mean, let's say I want to save the g开发者_如何学Craph 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!


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消