Thread Subject:
Saveas slow

Subject: Saveas slow

From: Jonathan

Date: 22 Jun, 2012 10:18:06

Message: 1 of 3

I am using matlab to generate a report containing a few hundred images.

The slowest part of my program is when I save the images using the following code:

saveas(gcf,full_path,'png');

where full_path is a string containing the filename.

I have tried using Visible Off. And running the code in a parallel loop. But it is still slow. It takes about 0.2 seconds to save an image. I have also tried using a ramdisk, but that did not help.

Are there any better ways of saving my images?

Thanks.

Subject: Saveas slow

From: Nasser M. Abbasi

Date: 22 Jun, 2012 10:21:32

Message: 2 of 3

On 6/22/2012 5:18 AM, Jonathan wrote:
> I am using matlab to generate a report containing a few hundred images.
>
> The slowest part of my program is when I save the images using the following code:
>
> saveas(gcf,full_path,'png');
>
> where full_path is a string containing the filename.
>
> I have tried using Visible Off. And running the code in a parallel loop.
>But it is still slow. It takes about 0.2 seconds to save an image.
>I have also tried using a ramdisk, but that did not help.
>
> Are there any better ways of saving my images?
>
> Thanks.
>

try export_fig

http://www.mathworks.com/matlabcentral/fileexchange/23629

--Nasser

Subject: Saveas slow

From: Oliver Woodford

Date: 22 Jun, 2012 10:34:07

Message: 3 of 3

"Jonathan" wrote:
> I am using matlab to generate a report containing a few hundred images.
>
> The slowest part of my program is when I save the images using the following code:
>
> saveas(gcf,full_path,'png');
>
> where full_path is a string containing the filename.
>
> I have tried using Visible Off. And running the code in a parallel loop. But it is still slow. It takes about 0.2 seconds to save an image. I have also tried using a ramdisk, but that did not help.
>
> Are there any better ways of saving my images?
>
> Thanks.

If you want speed then the fastest way is to use getframe and imwrite. However, this means the figure needs to remain visible on the desktop.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us