| MATLAB Function Reference | Search  Help Desk | 
| nargchk | Examples See Also | 
Check number of input arguments
msgThe=nargchk(low,high,number)
nargchk function often is used inside an M-file to check that the correct number of arguments have been passed.
msg = nargchk(low,high,number)
returns an error message if number is less than low or greater than high. If number is between low and high (inclusive), nargchk returns an empty matrix.
low, high
 
The minimum and maximum number of input arguments that should be passed.
 
number
The number of arguments actually passed, as determined by the nargin function.
 
 
Given the function foo:
function f = foo(x,y,z) error(nargchk(2,3,nargin))Then typing
foo(1) produces:
Not enough input arguments.
nargin, nargout