FUNCTION REFERENCE

nargin

Number of input arguments of a function.

Number of input arguments of a function.

Syntax

nargin

Syntax

nargin(fun)

Inside a function it returns how many inputs the caller passed.

Example

n = nargin   % inside a function called with 2 inputs: 2

Function names and handles report declared input counts; varargin 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.