Assuming you have a lot of figures to plot, but you do not want to wait and see them in Matlab's figure window. There is a way you can export all of your figures without displaying them. This might also save you some time, since you are drawing them on the screen.
Here is how :
% Create a figure with visibility off
f = figure('Visible','off');
% Then do your plot
plot
% Finally export the plot as an image
print('-dpng', 'test.png');
You can also make this in a loop (Which is very probable if you have too many figures).
Do this
for i:1, n
f = figure('Visible','off');
plot
filename = sprintf('plot-%d',i);
print('-dpng', filename);
end
This will give you 'n' png images with your plots in it.
11 comments:
Hi !
Wow, it helps so much!
Was looking for this for VERY long time.
Thanks. Very helpful.
Thanks!Very Helpful
Thank you, quite useful!
very simple and so useful... thanks!
Fantastic. Thanks a lot.
thanks Bro, by the way the one over me is gay!
but the problem is, that u cannot save .fig like that. They remain invisible after saving. Does anyone has the solution for that?
Thanks, this is useful
I have the same problem. I can not open saved invisible figure. Does someone have a tip?
To Vladimir Zaplava, you can see the figure again using this code :
set(gcf,'visible','on')
Hope that help
Post a Comment