nargoutchk
Validate number of output arguments
Syntax
Description
nargoutchk(
validates the number of output arguments specified in the current function call. minArgs
,maxArgs
)nargoutchk
throws an error if the number of outputs is less than minArgs
or greater than maxArgs
. If the number of outputs is between minArgs
and maxArgs
(inclusive), then nargoutchk
does nothing.
Examples
Input Arguments
Output Arguments
Tips
To verify that you have a minimum number of arguments, but no maximum number, set
maxArgs
toinf
. For example:nargoutchk(5,inf)
throws an error when there are fewer than five outputs.To verify that you have an exact number of arguments, specify the same value for
minArgs
andmaxArgs
. For example:nargoutchk(3,3)
throws an error when you do not have exactly three outputs.If
minArgs
is 0 andmaxArgs
isnargout
, then you do not need to usenargoutchk
.
Extended Capabilities
Version History
Introduced before R2006a