nargout

nargout returns the number of output arguments requested from current function.

See also

nargin