saving figures in matlab
6 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
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);
0 件のコメント
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/
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!