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 CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by