R = nargin()
R = nargin(function_name)
R = nargin(function_handle)
| Parameter | Description |
|---|---|
| function_name | a string: function name |
| function_handle | a function handle |
| Parameter | Description |
|---|---|
| R | an integer value: number of input arguments |
nargin returns the number of input arguments of a function.
When called without an input argument, nargin returns the number of input arguments used to call the currently executing function.
When called with a function name or function handle, nargin returns the number of input arguments declared by that function.
If the last declared input argument is varargin, the returned value is negative. Its absolute value is the total number of declared input arguments, including varargin. For example, for a function declared as f(a, b, varargin), nargin('f') returns -3.
nargin('getfield')
nargin('cos')
| Version | Description |
|---|---|
| 1.0.0 | initial version |