Thread Subject: Print figures to a specified folder

Subject: Print figures to a specified folder

From: AHMET ANIL DINDAR

Date: 2 Mar, 2007 11:16:35

Message: 1 of 4

Hi all,
I'm sure there is one who can answer my question.
I'm creating several figures and saving them by "print" command.
However, I would like to save them into a user-specified folder. It
might be nice to have solution in the syntax of
print('-f1', '-dpng',user_specified_folder','filename');

Thanks in advance.

Subject: Print figures to a specified folder

From: Trevor B

Date: 2 Mar, 2007 11:34:36

Message: 2 of 4

>> print -dpng [path filename]

For example, if you're in the directory C:\dir1\ and you wish to
print pic.eps to the directory C:\dir2\dir3\, you can type:

>> print -dpng ..\dir2\dir3\pic.eps

You can use absolute paths as well.

 AHMET ANIL DINDAR wrote:
>
>
> Hi all,
> I'm sure there is one who can answer my question.
> I'm creating several figures and saving them by "print" command.
> However, I would like to save them into a user-specified folder. It
> might be nice to have solution in the syntax of
> print('-f1', '-dpng',user_specified_folder','filename');
>
> Thanks in advance.

Subject: Print figures to a specified folder

From: AHMET ANIL DINDAR

Date: 2 Mar, 2007 11:46:31

Message: 3 of 4

Trevor hi,
I think what you recommended is not working. because it says

>> print -f1 -dpng ..\dir2\pic.eps
??? Error using ==> print
Error using ==> c:/matlab6p5/toolbox/matlab/graphics/private/name
Cannot create output file '..\dir2\pic.eps'

I wanted my figure(1) to save a directory named as dir2 with the name
pic as .png file.

sorry, I could not succeded.

Subject: Print figures to a specified folder

From: craq

Date: 14 Jul, 2009 16:08:03

Message: 4 of 4

I just had the same problem and managed to solve it, but I couldn't find my solution anywhere on the web...

Actually my mistake was pretty dumb - just a typo in the pathname - but the real limitation is that the print command can't create a new directory. (Note this is a useful limitation, otherwise my image would've ended up in a completely different folder and I'd never find it.)

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 at files@mathworks.com