help-octave
[Top][All Lists]
Advanced

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

Re: Getting 'for' loop to print only once using echo/diary


From: Martin Senator
Subject: Re: Getting 'for' loop to print only once using echo/diary
Date: Fri, 9 Mar 2012 15:41:48 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Jordi,
Thanks.  I do write the program in a script.
Then the first line of the interactive session runs the commands of the script,
echos then to the screen, saves everything in the diary file, and then
waits for more commands with diary turned off.

I figured out a way to get what I want though.
At the end of the for loop, just before the 'endfor;,
I have a command to turn off echoing.
Then, after the endfor I have a command to turn on echoing.

Thanks,
Martin

On Thu, Mar 08, 2012 at 02:34:42PM -0500, Jordi Gutiérrez Hermoso wrote:
> On 1 March 2012 11:07, Martin Senator <address@hidden> wrote:
> > I am using a 'for' loop in a script (because I can't
> > get 'roots' to work on a vector).
> 
> What problem are you facing here?
> 
> > I start an interactive Octave session with:
> >       $ octave -q
> > Then I issue the command (junk.m is the name of the script file):
> >       octave:1> diary on, echo on, more off,junk
> > The last two lines of the script are:
> >      [now] = ctime(time) #;
> >      diary off
> > After the script runs Octave is ready for more interactive commands.
> > But, the 'for' loop is in the 'diary' file 101 times.
> >
> > What can I do to get the desired behavior?
> 
> I can't think of an easy way to do this with diary, but perhaps you
> could just write your program in a script from the beginning?
> 
> - Jordi G. H.


reply via email to

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