How to define a function that can have multiple variables.
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
the cyclist
2012년 6월 11일
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:
댓글 수: 3
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!