MATLAB Excel Builder    

Processing varargin and varargout Arguments

When varargin and/or varargout are present in the original MATLAB function, these parameters are added to the argument list of the class method as the last input/output parameters in the list. You can pass multiple arguments as a varargin array by creating a Variant array, assigning each element of the array to the respective input argument.

The following example creates a varargin array to call a method resulting from a MATLAB function of the form y = foo(varargin).

The MWUtil class included in the MWComUtil utility library provides the MWPack helper function to create varargin parameters. See Utility Library for more details.

The next example processes a varargout parameter into three separate Excel Ranges. This function makes use of the MWUnpack function in the utility library. The MATLAB function used is varargout = foo(x1,x2).


  Calling the Methods of a Class Instance Handling Errors During a Method Call