External Interfaces Previous page   Next Page

Converting Data

Since COM defines a number of different data formats and types, you need to know how MATLAB converts data from COM objects into variables in the MATLAB workspace. Data from COM objects must be converted:

This chart shows how COM data types are converted into variables in the MATLAB workspace.

Conversion of COM data types into MATLAB variables

Passing Data from MATLAB to ActiveX Objects.

The following table shows the mapping of MATLAB data types to COM data types that you must use to pass data from MATLAB to an ActiveX object.

Note that all other types result in a warning:

"ActiveX -- invalid argument type or value".

MATLAB Data Type
Converted to COM Data Type
double
VT_R8 (8 byte real)
NaN
VT_ERROR (SCODE)
CHAR
VT_BSTR (OLE Automation string)
SINGLE
VT_R4 (4 byte real)
INT8
VT_I1 (signed char)
UINT8
VT_UI1 (unsigned char)
INT16
VT_I2 (2 byte signed int)
UINT16
VT_UI2 (unsigned short)
INT32
VT_I4 (4 byte signed int)
UINT32
VT_UI4 (unsigned long)
INT64
VT_I8 (signed 64-bit int)
UINT64
VT_UI8 (unsigned 64-bit int)
Cell Array
VT_SAFEARRAY(VARIANT) (use VT_ARRAY in VARIANT)
Logical
VT_BOOL (VARIANT_BOOL) True=-1, False=0
Handle
VT_DISPATCH (IDispatch *)


Previous page  Additional COM Client Information Using MATLAB as a DCOM Client Next page

© 1994-2005 The MathWorks, Inc.