help-octave
[Top][All Lists]
Advanced

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

Existence of a variable


From: Daniel Tourde
Subject: Existence of a variable
Date: Fri, 08 Jan 1999 10:54:43 +0100

Hi !

I'm using a function defined like this

function F = f(a,b)
  ...
  if (b)
    ...
  endif
endfunction

I want to call the function f with one or two parameters (A = f(a) or B
= f(a,b))
Then I have a problem because in the first case b is not defined and
Octave complains. I tried to use the built-in function 'exist'

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 ?

Thanks in advance for any information.

Best regards


                        Daniel Tourde
-- 
***********************************************************************
Daniel TOURDE                                   E-mail : address@hidden
The Aeronautical Research Institute of Sweden   Tel : +46 8 55 54 93 44
P.O. Box 11021 S-161 11 BROMMA, Sweden          Fax : +46 8    25 34 81
***********************************************************************



reply via email to

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