User`s guide

2 Programming with MATLAB Builder for Excel
Modifying Flags
Each MATLAB Builder for Excel component exposes a single read/write
property named
MWFlags of type MWFlags.TheMWFlags property consists of
two sets of constants: array formatting flags and data conv ersion flags. Array
formatting flags affect the transformation of arrays, whereas data conversion
flags deal with type conversions of individual array elements.
The data conv ersion flags change selecte d behaviors of the data conversion
process from
Variants to MATLAB types and vice versa. By default, Excel
Builder components allow setting data conversion flags at the class level
through the
MWFlags class p roperty. This holds true for all Visual Basic
types, with the exception of the Excel Builder
MWStruct, MWField, MWComplex,
MWSparse,andMWArg types. Each of these types exposes its own MWFlags
property and ignores the properties of the class whose metho d 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 p rovides a general discussion of how to set these flags and what
they do. See “Class MWFlags” on page C-10 for a detailed discussion of the
MWFlags ty pe, a s well as additional co de 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
VariantsorasingleVariant 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 7.5 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#
2-14