help-octave
[Top][All Lists]
Advanced

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

Re: terminal or cursor control


From: Ben Sapp
Subject: Re: terminal or cursor control
Date: Fri, 18 May 2001 09:48:48 -0600

"E. Joshua Rigler" wrote:
> 
> Is it possible in Octave to rewrite a line without sending a newline?
> In otherwords, I want to send the values from a timer to stdout, but I
> don't want the whole screen to scroll.  I just want the bottom line to
> reprint over and over with the updated values of my timer/counter
> variable.
> 
> I hope there might be a simple way to return to the beginning of the
> line, but I would be satisfied if I could simply print backspace
> characters or something similar.

I think this will do somehting pretty close to what you want:

page_screen_output = 0;
page_output_immediately = 1;
octave:162> for i = 1:100
> printf("\r%d",i);
> sleep(1);
> endfor

The "\r" returns you to the beginning of the current line.  This little
script will print a 1, then a 2, ... all the way up to 100.   All on the
same line and erasing the number that was there before.  

-- 
Ben Sapp                         Los Alamos National Laboratory
email: <mailto:address@hidden>   Phone: (505)667-3277
Fax:   (505)665-7920             URL:   http://www.neutrino.lanl.gov/
--



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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