Check function arguments number.
Syntax
err = errargn('function',numargin,argin,numargout,argout)
Description
errargn is a general utility.
err = errargn('function',numargin,argin,numargout,argout) is equal to 1 if either the number of input (argin) or output (argout) arguments of the specified function does not belong to the vector of allowed values (numargin and
numargout, respectively). Otherwise err = 0.
If err = 1, errargn displays an error message in the command window. The header of this error message contains the string 'function'.
Examples
In this example, errargn reports an improper call to function line:
» err = errargn('line',4,[2 3],0,[0 1]);
****************************************
ERROR ...
----------------------------------------
line ---> invalid number of arguments
****************************************
Here, surf is passed the proper number of arguments, so no error message results:
» err = errargn('surf',4,[3 4],0,[0 1]);
See Also
errargt
[ Previous | Help Desk | Next ]