Navigation

Operators and Keywords

Function List:

C++ API

: nargoutchk (minargs, maxargs)
: msgstr = nargoutchk (minargs, maxargs, nargs)
: msgstr = nargoutchk (minargs, maxargs, nargs, "string")
: msgstruct = nargoutchk (minargs, maxargs, nargs, "struct")

Check for correct number of output arguments.

In the first form, return an error if the number of arguments is not between minargs and maxargs. Otherwise, do nothing. Note that this function evaluates the value of nargout on the caller so its value must have not been tampered with.

Both minargs and maxargs must be numeric scalars. Zero, Inf, and negative are all valid, and they can have the same value.

For backwards compatibility, the other forms return an appropriate error message string (or structure) if the number of outputs requested is invalid.

This is useful for checking to that the number of output arguments supplied to a function is within an acceptable range.

See also: narginchk, error, nargout, nargin.

Package: octave