nargoutchk
Checks the number of output arguments.
📝Syntax
nargoutchk(minArgs, maxArgs)
msg = nargoutchk(minArgs, maxArgs, numArgs)
st = nargoutchk(minArgs, maxArgs, numArgs, 'struct')
📥Input Arguments
Parameter Description
minArgs minimum number of accepted outputs (scalar integer value).
maxArgs maximum number of accepted outputs (scalar integer value).
numArgs number of function outputs (scalar integer value).
📤Output Arguments
Parameter Description
msg a string: error message.
st a struct with error message and identifier.
📄Description

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.

💡Examples
With an macro function:
nargoutchk(1, 2, 3)
nargoutchk(1, 2, 3, 'struct')
🔗See Also
nargoutnarginchk
🕔Version History
Version Description
1.0.0 initial version
1.10.0 nargoutchk(3, Inf) managed
Edit this page on GitHub