Variable-length input argument list
varargin
is an input variable in a function definition statement that enables the function to accept any number of input arguments. Specifyvarargin
using lowercase characters, and include it as the last input argument after any explicitly declared inputs.
When the function executes,varargin
is a 1-by-Ncell array, whereNis the number of inputs that the function receives after the explicitly declared inputs. However, if the function receives no inputs after the explicitly declared inputs, thenvarargin
is an empty cell array.