saving figures in matlab

6 ビュー (過去 30 日間)
MINA
MINA 2016 年 5 月 23 日
回答済み: Richard Quist 2016 年 5 月 24 日
Hello.
I am generating bunch of figures in matlab which is in a for loop. I would like to save them both in .fig and .jpg. Right now I am first plotting the figure and then save them. But I don't really need to see the figures and I just want to save them. Is there anyway that I do this so that the speed increases?
Thanks

回答 (2 件)

Richard Quist
Richard Quist 2016 年 5 月 24 日
You can try using an invisible figure:
% create an invisible figure
f = figure('visible', 'off');
% loop 10 times, saving .fig and .jpeg for a random plt
for idx = 1:10
% plot your data
plot(rand(10));
% save as .fig
savefig(f, sprintf('figure%d.fig', idx));
% save as jpeg
print(f, '-djpeg', sprintf('figure%d.jpg', idx));
% clear the figure
clf(f);
end
delete(f);

Image Analyst
Image Analyst 2016 年 5 月 24 日
Put
drawnow
right after you display the images. If it's still too fast, put in a
pause(0.3)
to delay it a little bit.
Don't save as .fig or .jpg. Save the axes as a .PNG. I recommend you use export_fig. http://blogs.mathworks.com/pick/2010/05/28/creating-and-exporting-publication-quality-graphics/

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by