User`s guide

B Data Conversion
B-2
Data Conversion Rules
This section describes the data conversion rules for MATLAB Excel Builder
components. Excel Builder components are dual interface COM objects that
support COM Automation compatible data types. When a method is invoked on
a Excel Builder component, the input parameters are converted to MATLAB
internal array format and passed to the compiled MATLAB function. When the
function exits, the output parameters are converted from MATLAB internal
array format to COM Automation types.
The COM client passes all input and output arguments in the compiled
MATLAB functions as type
VARIANT. The COM VARIANT type is a union of
several simple data types. A type
VARIANT variable can store a variable of any
of the simple types, as well as arrays of any of these values. The Win32
Application Program Interface (API) provides many functions for creating and
manipulating
VARIANTs in C/C++, and Visual Basic provides native language
support for this type. See the Visual Studio documentation for definitions and
API support for COM
VARIANTs. VARIANT variables are self describing and store
their type code as an internal field of the structure.
Table B-1 lists the
VARIANT type codes supported by Excel Builder components.
Table B-2 and Table B-3 list the data conversion rules between COM
VARIANTs
and MATLAB arrays.
Table B-1: VARIANT Type Codes Supported
VARIANT Type Code
(C/C++)
C/C++ Type Variant
Type Code
(Visual
Basic)
Visual
Basic
Type
Definition
VT_EMPTY - vbEmpty -
Uninitialized VARIANT
VT_I1 char - -
Signed one-byte
character
VT_UI1
unsigned char
vbByte Byte
Unsigned one-byte
character
VT_I2 short vbInteger Integer
Signed two-byte integer