Conversion of MATLAB Types to COM Types

The following table shows how MATLAB® converts data from MATLAB to COM types.

MATLAB TypeClosest COM TypeAllowed Types
handleVT_DISPATCH
VT_UNKNOWN
VT_DISPATCH
VT_UNKNOWN
character vector VT_BSTRVT_LPWSTR
VT_LPSTR
VT_BSTR
VT_FILETIME
VT_ERROR
VT_DECIMAL
VT_CLSID
VT_DATE
int16 VT_I2VT_I2
uint16VT_UI2VT_UI2
int32VT_I4VT_I4
VT_INT
uint32VT_UI4VT_UI4
VT_UINT
int64VT_I8VT_I8
uint64VT_UI8VT_UI8
singleVT_R4VT_R4
double VT_R8VT_R8
VT_CY
logicalVT_BOOL VT_BOOL
char VT_I1VT_I1
VT_UI1

Variant Data

variant is any data type except a structure or a sparse array. (For more information, see Fundamental MATLAB Classes.)

When used as an input argument, MATLAB treats variant and variant(pointer) the same way.

If you pass an empty array ([]) of type double, MATLAB creates a variant(pointer) set to VT_EMPTY. Passing an empty array of any other numeric type is not supported.

MATLAB ArgumentClosest COM TypeAllowed Types
variant VT_VARIANTVT_VARIANT
VT_USERDEFINED
VT_ARRAY
variant(pointer)VT_VARIANTVT_VARIANT | VT_BYREF

SAFEARRAY Data

When a COM method identifies a SAFEARRAY or SAFEARRAY(pointer), the MATLAB equivalent is a matrix.

MATLAB ArgumentClosest COM TypeAllowed Types
SAFEARRAYVT_SAFEARRAYVT_SAFEARRAY
SAFEARRAY(pointer) VT_SAFEARRAYVT_SAFEARRAY | VT_BYREF

Unsupported Types

MATLAB does not support the following COM types.

  • Structure

  • Sparse array

  • Multidimensional SAFEARRAYs (greater than two dimensions)

  • Write-only properties

See Also