User`s guide
Calling Conventions
A-9
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 Rules” on page B-2 lists the rules for
conversion between MATLAB arrays and COM
VARIANTs.
Visual Basic Mapping
The Visual Basic mapping to the IDL signature shown above is
Sub foo(nargout As Long, _
Y1 As Variant, _
Y2 As Variant, _
.
.
varargout As Variant, _
X1 As Variant, _
X2 As Varaint, _
.
.
varargin As Variant)
(See the COM documentation for mappings to other languages, such as C++.)
Visual Basic provides native support for COM
VARIANTs with the Variant type,
as well as implicit conversions for all Visual Basic basic types to and from
Variants. In general, arrays/scalars of any Visual Basic basic type, as well as
arrays/scalars of
Variant types, can be passed as arguments. MATLAB Excel
Builder components also provide direct support for the Excel
Range object, used
by Visual Basic for Applications to represent a range of cells in an Excel
worksheet. See the Visual Basic for Applications documentation included with
Microsoft Excel for more information on Visual Basic data types and Excel
Range manipulation.