From help-octave-request at bevo dot che dot wisc dot edu Fri Jan 8 04:10:16 1999 Subject: Re: Existence of a variable From: Fan Lixin To: Daniel Tourde cc: help-octave at bevo dot che dot wisc dot edu 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