FUNCTION REFERENCE
nargout
Number of output arguments of a function.
Number of output arguments of a function.
Syntax
nargoutSyntax
nargout(fun)Inside a function it returns how many outputs the caller requested.
Example
n = nargout % inside a function called as [a,b] = f(): 2Function names and handles report declared output counts; varargout makes the count negative. Builtin counts without signature metadata are unknown.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.