varargin
Specify that a function can take a variable number of arguments.
Syntax
function goo(a,varargin)
end
Inputs
- varargin
- Whatever can be assigned to a variable.
Example
Simple varargin example.
Note: varargin must be the
last variable in the argument list.
function goo(a,varargin)
disp(a)
disp(varargin{1}) % it should print 2 here
end
goo(1,2,3);
1
2