<< nargout | Core | nelsonroot >> |
nargoutchk(minArgs, maxArgs) |
msg = nargoutchk(minArgs, maxArgs, numArgs) |
st = nargoutchk(minArgs, maxArgs, numArgs, 'struct') |
minimum number of accepted outputs (scalar integer value).
maximum number of accepted outputs (scalar integer value).
number of function outputs (scalar integer value).
a string: error message.
a struct with error message and identifier.
nargoutchk checks the number of output arguments of an function.
To ensure a minimum number of outputs while imposing no maximum limit, set maxArgs to inf. For example, nargoutchk(2, inf) generates an error if fewer than two outputs are specified.
With an macro function:
nargoutchk(1, 2, 3)
nargoutchk(1, 2, 3, 'struct')
Version | Description |
---|---|
1.0.0 | initial version |
1.10.0 | nargoutchk(3, Inf) managed |
Allan CORNET