MATLAB Excel Builder    

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

This example converts var1 of type Variant/Integer to an int16 and var2 of type Variant/Double to a double. If the original MATLAB function expects doubles for both arguments, this code might cause an error. One solution is to assign a double to var1, but this may not be possible or desirable. In such a case set the CoerceNumericToType flag to mwTypeDouble, causing the data converter to convert all numeric input to double. In the previous example, place the following line after creating the class and before calling the methods.

The InputDateFormat flag controls how the VBA Date type is converted. This example sends the current date and time as an input argument and converts it to a string.

The next example uses an MWArg object to modify the conversion flags for one argument in a method call. In this case the first output argument (y1) is coerced to a Date, and the second output argument (y2) uses the current default conversion flags supplied by aClass.


  Array Formatting Flags Usage Examples