From: Steven on
Hi,

I am having to save lots of figure files and wanted to do it inside my m-file. I was using the saveas function, but that only seems to save in your current directory. Is there any way to save figures in a specified directory? Thanks,

Steven
From: us on
"Steven " <shimizust(a)gmail.com> wrote in message <hubtlp$96l$1(a)fred.mathworks.com>...
> Hi,
>
> I am having to save lots of figure files and wanted to do it inside my m-file. I was using the saveas function, but that only seems to save in your current directory. Is there any way to save figures in a specified directory? Thanks,
>
> Steven

one of the solutions
- you simply add a partial or full path...

fpat='folder_1';
fnam='foo.fig';
plot(1:10);
saveas(gcf,[fpat,filesep,fnam],'fig');

us
From: ImageAnalyst on
Or you can call the fullfile() function, or just change the folder
with cd beforehand and not mess with the folder at all. I always
prefer to make my filenames real explicit with sprintf() and
fullfile() and not count on the current working directory being
something in particular.
From: Steven on
Thanks for the help, us and ImageAnalyst. It works great!