MATLAB Function Reference    
nargchk

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

Input arguments to nargchk are

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

nargoutchk, nargin, nargout, varargin, varargout


  NaN nargin, nargout