help-octave
[Top][All Lists]
Advanced

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

Re: Existence of a variable


From: Fan Lixin
Subject: Re: Existence of a variable
Date: Fri, 8 Jan 1999 18:10:09 +0800 (GMT-8)

On Fri, 8 Jan 1999, Daniel Tourde wrote:

> 
> I hoped that exist(b) will give me 0 or 1 as explained in the help.
> Unfortunately, when I type exist(b), Octave complains and tell me that b
> does not exist, which is what I want to test, the existence of the
> variable b. I do not obtain the 0 value whuch would have been useful in
> a test like this
> 
> if (exist(b))
>    if (b) 
> ...
> 
> 
> Does anyone has an idea about how I could solve this problem ?
> 

Not complete answer to your question, just some tips about using exist. 
Seems 'exist' expects string value as its argument, and you should call
'exist' like this:

if( exist("b") )
    if( b )
...

regards,

-Lixin



reply via email to

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