help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: figures not saved inside loop


From: andre valente
Subject: RE: figures not saved inside loop
Date: Tue, 30 Jun 2015 10:19:56 +0000

> Date: Tue, 30 Jun 2015 12:01:16 +0200
> Subject: Re: figures not saved inside loop
> From: address@hidden
> To: address@hidden
> CC: address@hidden; address@hidden
>
> On Tue, Jun 30, 2015 at 11:57 AM, andre valente <address@hidden> wrote:
> > The problem is quite simple. For example the code below, sometimes saves all
> > the figures, sometimes it doesn't. This is not my regular machine, so I
> > guess the problem is with the machine and not with octave.. anyway I would
> > be very happy to fix this problem.
> >
> > a=rand(100,20);
> > for i=1:20;
> > figure;plot(a(:,i));
> > outname=strcat('figure_',num2str(i));
> > eval(['print -dpng ',outname]);
> > close;
> > end
> >
> >
> >> Date: Mon, 29 Jun 2015 21:44:06 +0200
> >> Subject: Re: figures not saved inside loop
> >> From: address@hidden
> >> To: address@hidden
> >> CC: address@hidden; address@hidden
> >>
> >> On Mon, Jun 29, 2015 at 8:05 PM, andre valente <address@hidden>
> >> wrote:
> >> > Hello,
> >> >
> >> > I have a loop quite fast (not sure this is part of the problem) making
> >> > plots
> >> > and saving them as png's. Some of the figures are not saved. I made some
> >> > tests, and appears to be random.. sometimes it saves, other times it
> >> > doesn't. They pop-up as figures, but just are not saved. Is this normal?
> >> > It
> >> > is quite a problem for me.. Hope you can help. Thanks.
> >> >
> >> > I am using version 3.8.2 for x86_64-redhat-linux-gnu .
> >> >
> >> > Regards,
> >> > Andre
> >> >
> >> > _______________________________________________
> >> > Help-octave mailing list
> >> > address@hidden
> >> > https://lists.gnu.org/mailman/listinfo/help-octave
> >> >
> >>
> >> I do not have this problem. Could you share your test code to see if
> >> we can reproduce.
>
> Try,
>
> figure (1);
> outname = @(x) sprintf ("figure_%d.png", x)
> a = rand (100,20);
> for i = 1:20;
> clf;
> plot (a(:,i));
> print ("-dpng",outname (i));
> end
>
> If it doesn't work: What is the output of
>
> graphics_toolkit
>
> ?
>
> PS: Please answer at the bottom of the message as I am doing here.

Ok, I tried 4 times and saved all figures. So it appears to work. What do you think was the problem with my script? Or the solution with yours?
The "clf" before the figure?
Opening a figure before?
How you defined outname.. ?
Also noticed your script was much slower.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]