nargoutchk
Validate the number of output arguments.
Syntax
Section titled “Syntax”msg = nargoutchk(nminarg, nmaxarg)msg = nargoutchk(nminarg, nmaxarg, numargs, 'string')Description
Section titled “Description”Returns an error message string if nargout (the number of requested outputs) is outside [nminarg, nmaxarg]. Used inside function bodies to enforce constraints on how many outputs the caller requested.
Examples
Section titled “Examples”function [a, b, c] = foo(...) nargoutchk(0, 3);end