Skip to content

nargchk

miscellaneous · scripts/miscellaneous/nargchk.m

: msg = nargchk (minargs, maxargs, nargs)
: msg = nargchk (minargs, maxargs, nargs, "string")
: s = nargchk (minargs, maxargs, nargs, "struct")

Check that the number of arguments nargs lies within the range minargs to maxargs.

The result is an empty string (or a 0x1 struct array in "struct" mode) when the count is acceptable, otherwise an error message (or a struct with the fields message and identifier).