User`s guide

2 Programming with MATLAB Builder for Excel
Setting this flag presents all array input to the compiled MATLAB function
as cell arrays.
Similarly, you can manipulate the format of output arguments using the
OutputArrayFormat flag. You can also modify array output with the
AutoResizeOutput and TransposeOutput flags.
AutoResizeOutput is used for Excel Range objects passed directly as output
parameters. When this flag is set, the target range automatically resizes to fit
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 c olumns 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 conv erted from VBA to M ATLAB.
Consider the example:
Sub foo( )
2-16