nargin
Number of input arguments passed to the current function.
Syntax
Section titled “Syntax”n = narginDescription
Section titled “Description”Inside a function body, returns the number of arguments the caller actually passed. Common for implementing optional parameters with defaults:
function y = foo(x, scale) if nargin < 2; scale = 1.0; end y = x * scale;endExample
Section titled “Example”if nargin < 2; b = 10; end