User`s guide
3 Programming with Excel Builder Components
3-16
the resulting array. If this flag is not set, the target range must be at least as
large as the output array or the data is truncated.
The
TransposeOutput flag transposes all array output. This flag is useful when
dealing with MATLAB functions that output one-dimensional arrays. By
default, MATLAB realizes one-dimensional arrays as 1-by-n matrices (row
vectors) that become rows in an Excel worksheet.
You may prefer worksheet columns from row vector output. This example
auto-resizes and transposes an output range.
Sub foo(Rout As Range, Rin As Range )
Dim aClass As mycomponent.myclass
On Error Goto Handle_Error
Set aClass = New mycomponent.myclass
aClass.MWFlags.ArrayFormatFlags.AutoResizeOutput = True
aClass.MWFlags.ArrayFormatFlags.TransposeOutput = True
Call aClass.foo(1,Rout,Rin)
Exit Sub
Handle_Error:
MsgBox(Err.Description)
End Sub
Data Conversion Flags
Data conversion flags deal with type conversions of individual array elements.
The two data conversion flags,
CoerceNumericToType and InputDateFormat,
govern how numeric and date types are converted from VBA to MATLAB.
Consider the example
Sub foo( )
Dim aClass As mycomponent.myclass
Dim var1, var2 As Variant
Dim y As Variant
On Error Goto Handle_Error
var1 = 1
var2 = 2#
Set aClass = New mycomponent.myclass
Call aClass.foo(1,y,var1,var2)
Exit Sub