narginNumber of input arguments
narginnargin(name)fname..m file of the function fname should be located in the current work folder.nargin(h)h is a function handle.h.f is given below, which expects 0 - 3 input arguments. The user gives 2 inputs and hence nargin is 2.function [a,b] = f(c,d,e)
disp('Number of input given:')
nargin
a = c;
b = d;
end
Running f(1,2); gives the following output.
Number of input given:
ans =
2.0000
f is the function defined in the example above.nargin('f')
ans =
3.000