Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
saving figures in run time

Subject: saving figures in run time

From: Jose

Date: 29 Apr, 2009 17:59:03

Message: 1 of 3

Hello Everyone, I have this code and I would like to save
the figures (1, 2,...,10) in files (run1.fig,run2.fig,...,run10.fig) in the run time.

 for i=1:10
    y=rand(1,100);
    figure;clf
    plot(y);
end


Thanks in advance,

cheers,

Jose.

Subject: saving figures in run time

From: dpb

Date: 29 Apr, 2009 18:09:02

Message: 2 of 3

Jose wrote:
> Hello Everyone, I have this code and I would like to save
> the figures (1, 2,...,10) in files (run1.fig,run2.fig,...,run10.fig) in the run time.
...

http://matlabwiki.mathworks.com/MATLAB_FAQ

Question 4.9 in the newsgroup FAQ ...

--

Subject: saving figures in run time

From: Jose

Date: 30 Apr, 2009 01:59:02

Message: 3 of 3

dpb <none@non.net> wrote in message <gta58q$du6$1@aioe.org>...
> Jose wrote:
> > Hello Everyone, I have this code and I would like to save
> > the figures (1, 2,...,10) in files (run1.fig,run2.fig,...,run10.fig) in the run time.
> ...
>
> http://matlabwiki.mathworks.com/MATLAB_FAQ
>
> Question 4.9 in the newsgroup FAQ ...
>
> Thanks dpb, but

I found an easy way with saveas to do it:

for i=1:1:10
    figure(i);
    plot(rand(1,100)) % put something in the figure

    saveas(i, strcat('filex_', int2str(i)), 'fig');
end

cheers,

Jose.




--

Tags for this Thread

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.

Contact us