MATLAB Function Reference    
nargoutchk

Validate number of output arguments

Syntax

Description

msg = nargoutchk(low,high,n) returns an appropriate error message if n is not between low and high. If the number of output arguments is within the specified range, nargoutchk returns an empty matrix.

Examples

You can use nargoutchk to determine if an M-file has been called with the correct number of output arguments. This example uses nargout to return the number of output arguments specified when the function was called. The function is designed to be called with one, two, or three output arguments. If called with no arguments or more than three arguments, nargoutchk returns an error message.

See Also

nargchk, nargout, nargin, varargout, varargin


  nargin, nargout nchoosek