saving figures in matlab

6 visualizaciones (últimos 30 días)
MINA
MINA el 23 de Mayo de 2016
Respondida: Richard Quist el 24 de Mayo de 2016
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

Respuestas (2)

Richard Quist
Richard Quist el 24 de Mayo de 2016
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 el 24 de Mayo de 2016
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/

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by