From help-octave-request at bevo dot che dot wisc dot edu Fri Jan 8 04:33:09 1999 Subject: Re: Existence of a variable From: Akira Nishimura To: ted at ffa dot se Cc: help-octave at bevo dot che dot wisc dot edu Date: Fri, 08 Jan 1999 19:33:01 +0900 From: Daniel Tourde 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 akira at rsch dot tuis dot ac dot jp Department of Information Systems Faculty of Business Administration and Information Science Tokyo University of Information Sciences