[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Existence of a variable
From: |
Akira Nishimura |
Subject: |
Re: Existence of a variable |
Date: |
Fri, 08 Jan 1999 19:33:01 +0900 |
From: Daniel Tourde <address@hidden>
Subject: Existence of a variable
Date: Fri, 08 Jan 1999 10:54:43 +0100
>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'
Another solution without `exist'; try with `nargin' variable.
exist_b = 1;
if nargin < 2
exist_b = 0;
endif
if exist_b
...
--
Akira NISHIMURA address@hidden
Department of Information Systems
Faculty of Business Administration and Information Science
Tokyo University of Information Sciences