help-octave
[Top][All Lists]
Advanced

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

Re: Octave-4.2.1 problem with "pause" command


From: Ying-Foon Chow (FEG)
Subject: Re: Octave-4.2.1 problem with "pause" command
Date: Mon, 17 Jul 2017 17:26:37 +0800

Thank you for your help.

YF


On Sun, Jul 16, 2017 at 10:38 PM, Doug Stewart <address@hidden> wrote:
On Sun, Jul 16, 2017 at 10:00 AM, Ying-Foon Chow (FEG) <address@hidden> wrote:
Hi,

I am a new user using Octave 4.2.1 in Windows 7. Somehow the following program always hang my machine if I don't specify a time in the "pause" command:

t=linspace(-1,1,1024);
plot(t,exp(t)),grid
title('exponential function')
pause
t0=clock;t=0;
while t<20
    axis([0 0 1 1]+exp(-t/5)*[-1 1 -1 1])
    drawnow
    t=etime(clock,t0);
end


That is, I can't get the figure to "move" no matter what key I press. Thanks in advance for any advice that may be offered.

YF


this works nice for me in Ubuntu

tt=linspace(-1,1,1024);
plot(tt,exp(tt)),grid
title('exponential function')
hold on                              ## I added this
pause
t0=clock;t=0;
while t<20
    axis([0 0 1 1]+exp(-t/5)*[-1 1 -1 1])
    drawnow
    t=etime(clock,t0);
end


I get a nice zoom in at 0,0
That should say (0,1)
To make the pause release you must click in the command window of octave and then press enter.

--
DAS



If you don't want to use so much CPU time then try this

tt=linspace(-1,1,1024);
plot(tt,exp(tt)),grid
title('exponential function')
hold on                              ## I added this
pause
t0=clock;t=0;
while t<20
    axis([0 0 1 1]+exp(-t/5)*[-1 1 -1 1])
    drawnow
    pause(.1)    # add this to reduce CPU usage
    t=etime(clock,t0);
end

--
DASCertificate for 206392



reply via email to

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