MATLAB Function Reference
  Go to function:
    Search    Help Desk 
nargchk    Examples   See Also

Check number of input arguments

Syntax

Description

The 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.

Arguments

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.

Examples

Given the function foo:

Then typing foo(1) produces:

See Also

nargin, nargoutNumber of function arguments



[ Previous | Help Desk | Next ]