![[MATLAB logo]](matlab_logo.gif) |
Exploiting MATLAB's Data Structures |
Variable argument lists
Usage: Used for functions that take or return optional parameters.
Example:
- function y = add(varargin)
- y = 0;
- for i = 1:length(varargin)
- y = y + varargin{i};
- end
Problem #5 - Exploding m-files

More info ...
- varargin and varargout are cell arrays that are automatically
mapped to the input and output lists when used in a function. Use normal
cell array syntax when manipulating them.
- varargin and varargout can be used with required input
and output arguments as long as varargin and varargout are
the last one in the declaration. That is function [a,b,varargout] =
myfun(c,d,varargin)

Copyright © 1997 The MathWorks, Inc.
clay@mathworks.com
$Revision$ $Date$