MATLAB COM Builder | ![]() ![]() |
IDL Mapping
The most generic MATLAB M-function is
This function maps directly to the following IDL signature.
HRESULT foo([in] long nargout, [in,out] VARIANT* Y1, [in,out] VARIANT* Y2, . . [in,out] VARIANT* varargout, [in] VARIANT X1, [in] VARIANT X2, . . [in] VARIANT varargin);
This IDL function definition is generated by producing a function with the same name as the original M-function and an argument list containing all inputs and outputs of the original plus one additional parameter, nargout
. (nargout
is not produced if you compile an M-function containing no outputs.) When present, the nargout
parameter is an [in]
parameter of type long
. It is always the first argument in the list. This parameter allows correct passage of the MATLAB nargout
parameter to the compiled M-code. Following the nargout
parameter, the outputs are listed in the order they appear on the left side of the MATLAB function, and are tagged as [in,out]
, meaning that they are passed in both directions. The function inputs are listed next, appearing in the same order as they do on the right side of the original function. All inputs are tagged as [in]
parameters. When present, the optional varargin
/varargout
parameters are always listed as the last input parameters and the last output parameters. All parameters other than nargout
are passed as COM VARIANT
types. Data Conversion Ruleslists the rules for conversion between MATLAB arrays and COM VARIANT
s.
![]() | Producing a COM Class | Visual Basic Mapping | ![]() |