Asked by C Zeng
on 11 Jun 2012

For example f(x,y,z) or f(x,y), z is optional. If I list three variables then system uses f(x,y,z), if only 2 variables uses f(x,y).

I know how to use it by nargin function, is there better way to do so?

Thanks.

*No products are associated with this question.*

Answer by the cyclist
on 11 Jun 2012

Accepted answer

When you say you know how to do it by nargin, does that mean you are also familiar with varargin? That sounds like what you want.

>> doc varargin

There is an example on this page:

Opportunities for recent engineering grads.

## 0 Comments