User`s guide

3 Programming with Excel Builder Components
3-14
Modifying Flags
Each MATLAB Excel Builder component exposes a single read/write property
named
MWFlags of type MWFlags. The MWFlags property consists of two sets of
constants: array formatting flags and data conversion flags. The data
conversion flags change selected behaviors of the data conversion process from
Variants to MATLAB types and vice versa. By default, MATLAB Excel Builder
components allow setting data conversion flags at the class level through the
MWFlags class property. This holds true for all Visual Basic types, with the
exception of the Excel Builder
MWStruct, MWField, MWComplex, MWSparse, and
MWArg types. Each of these types exposes its own MWFlags property and ignores
the properties of the class whose method is being called. The
MWArg class is
supplied specifically for the case when a particular argument needs different
settings from the default class properties.
This section provides a general discussion of how to set these flags and what
they do. See Class MWFlags on page D-9 for a detailed discussion of the
MWFlags type, as well as additional code samples.
Array Formatting Flags
Array formatting flags guide the data conversion to produce either a MATLAB
cell array or matrix from general
Variant data on input or to produce an array
of
Variants or a single Variant containing an array of a basic type on output.
The following examples assume that you have referenced the
MWComUtil
library in the current project by selecting
Tools -> References and selecting
MWComUtil 1.0 Type Library from the list.
Sub foo( )
Dim aClass As mycomponent.myclass
Dim var1(1 To 2, 1 To 2), var2 As Variant
Dim x(1 To 2, 1 To 2) As Double
Dim y1,y2 As Variant
On Error Goto Handle_Error
var1(1,1) = 11#
var1(1,2) = 12#
var1(2,1) = 21#
var1(2,2) = 22#
x(1,1) = 11