Effacer les filtres
Effacer les filtres

Export figure is painfully slow. Save as png is fast. Why?

15 vues (au cours des 30 derniers jours)
Knut
Knut le 20 Juin 2011
I tend to export some figures for use in presentations etc. I have noticed that for some figures (perhaps those with lots of data), Matlab will grind to a halt when I try to export the image to the OS pasting buffer. Sometimes I end up killing the Matlab session.
Recently, I figured out that if I instead save the image as e.g. *.png, it is really fast. Any idea why this is? Is it a bug? How hard can it be to render into a VGA-ish image buffer?

Réponse acceptée

Patrick Kalita
Patrick Kalita le 20 Juin 2011
The reason is that MATLAB is not exactly rendering to a "VGA-ish image buffer" when you copy to clipboard. The default setting is for MATLAB to attempt to copy in a Windows Metafile format. This format mixes vector and bitmap elements. So, yeah, if you have a lot of data and it is trying to encode those in a vector format, it could take a while.
You do have control over the format MATLAB uses for figure copying. In a figure window select Edit -> Copy Options. In the Preferences dialog that opens if you select "Bitmap" you will get a simple bitmap version of the figure copied to the clipboard -- which should be faster.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by