how to save a plot ?
Afficher commentaires plus anciens
I have two large data sets. Usually it takes a lot of time to save a plot on hard drive. I wonder how I can save a plot as jpeg file in a quick way. Usually it takes a lot of time to save a plot on hard drive. I apperciate your help.
saveas(gcf,'C:\plot.jpg')
delete(gcf)
5 commentaires
Hassan
le 19 Juin 2011
Walter Roberson
le 19 Juin 2011
saveas() requires rendering the plot; it is almost always faster to save() the plot data rather than rendering it.
Hassan
le 19 Juin 2011
Walter Roberson
le 19 Juin 2011
save() is the counterpart of load()
http://www.mathworks.com/help/techdoc/ref/save.html
It stores the data instead of the image, so whether it is useful to you depends on what you need to do afterwards.
Hassan
le 20 Juin 2011
Réponses (2)
Jan
le 19 Juin 2011
1 vote
I guess that it is not the saving, but the drawing of the plot, which consumes the most time. "delete(gcf)" means, that you create a new figure for each plot. This is much slower than using the same figure and only update the axes object, or even better: Keep the axes also and update just the children.
So please insert a DRAWNOW before the method for sving and use the PROFILEr to find the most time consuming lines.
6 commentaires
Hassan
le 19 Juin 2011
Jan
le 19 Juin 2011
DRAWNOW cannot accelerate the processing, but it flushs all former drawing commands. Without DRAWNOW the update of the figure is done inside the procedure for saving, such that the profile gets wrong timings.
Can you post the results of the profiler or relevant parts of the code? What is "prin"?
Hassan
le 19 Juin 2011
Hassan
le 19 Juin 2011
Walter Roberson
le 19 Juin 2011
So effectively the bulk of the time is being used in the built-in function toolbox/matlab/graphics/hardcopy which is being called by the plot renderer.
Hassan
le 20 Juin 2011
Walter Roberson
le 19 Juin 2011
0 votes
3 commentaires
Hassan
le 19 Juin 2011
Walter Roberson
le 19 Juin 2011
Hmm... what kind of scene elements do you use? If you do not have transparency, then _possibly_ changing the renderer property of the figure or the drawmode property of axes could help. Unfortunately I do not know how rendering is done for saving images, so these things might not make any difference.
Hassan
le 19 Juin 2011
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!