narginchk
Checks the number of input arguments.
📝Syntax
narginchk(minArgs, maxArgs)
📥Input Arguments
Parameter Description
minArgs minimum number of accepted inputs (scalar integer value).
maxArgs maximum number of accepted inputs (scalar integer value).
📄Description

narginchk checks the number of input arguments of an function.

To ensure that a minimum number of arguments is provided, while allowing an unlimited maximum number by setting maxArgs to inf. For instance, use narginchk(2, inf) to throw an error if fewer than two inputs are supplied.

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