help-octave
[Top][All Lists]
Advanced

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

Re: error() [was Re: wavread problems]


From: Keith Goodman
Subject: Re: error() [was Re: wavread problems]
Date: Wed, 11 May 2005 15:39:39 -0700

So if you run the script

error('I am stopping here')
disp('No you are not')
error('Oh yes I am\n')
disp('OK, you win')

you're saying that 'No you are not' and 'Oh yes I am' are printed? The
output should only be 'I am stoppping here' plus a list of where the
function was called from.

On 5/11/05, Robert A. Macy <address@hidden> wrote:
> NOW I see what you mean.
> 
> I did a test inside a function to make certain the argument
> was of a proper form.  All code and operations concerning
> the test were valid octave operations.
> 
> I used to default print a line after such a test...
> if (argument is stupid)
>   errormsg="wrong form, idiot"
>   return;
> endif
> ...doing this created a single error line and then a prompt
> 
> I now do this...
> if (argument is stupid)
>   error("wrong form, dolt\n";
> endif
> ...which prints a nice line too and then a prompt.
> 
> both stop the function at that test and all is well.
> 
> HOWEVER, when I leave out the \n; the program keeps trying
> to execute and spits up later when illegal activities start
> to occur.
> 
>             - Robert -
> 
> On Wed, 11 May 2005 12:28:26 -0700
>  Keith Goodman <address@hidden> wrote:
> > Are you sure it is attempting the code? It should just be
> > unwinding
> > the stack of functions that called the error line and at
> > each one
> > printing out the line and column numbers.
> >
> > I find it difficult, by the way, to visually unwind the
> > error
> > messages. Would clever formatting help?
> >
> > On 5/11/05, Robert A. Macy <address@hidden> wrote:
> > > Interestingly, on 2.1.50 binary the phrase...
> > > error("need two arguments");
> > > ...after an if() test DOES NOT return you from the
> > > function.  octave attempts the rest of the code.
> > > However,...
> > > error("need two arguments\n");
> > > ...does return you and the rest of the code is NOT
> > > attempted.
> > >
> > >             - Robert -
> > >
> > > On Wed, 11 May 2005 13:08:04 -0400
> > >  "John W. Eaton" <address@hidden> wrote:
> > > > On 11-May-2005, Doug Stewart wrote:
> > > >
> > > > BTW, you can write
> > > >
> > > >   error ("%s is not a WAV file", wavefile);
> > > >
> > > > instead of using sprintf because the error function
> > > > processes
> > > > arguments the same as printf.
> > > >
> > > > jwe
> > >
> > >
> >
> -------------------------------------------------------------
> > > 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
> > >
> >
> -------------------------------------------------------------
> > >
> > >
> 
>



-------------------------------------------------------------
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]