The default data conversion rules for MATLAB's COM interface specifies that arrays are passed by value.
Beginning with MATLAB 7.0.4 (R14SP2) it is possible to work around the default data conversion rule and have MATLAB pass the array by reference. You can pass SAFEARRAYs to ActiveX servers by reference by executing the following command at the MATLAB prompt:
Note that setting this feature may break COM interaction with Excel, including Excel Link. If you wish to reset the default behavior of MATLAB of passing all data by value, execute:
You can also query the current state of this property with the command
Note on passing Numeric arrays by reference: MATLAB supports passing a VARIANT type by reference to COM object. Since cell arrays are converted as SAFEARRAY of VARIANT's, COM_PassSafeArrayByRef works only with cell arrays. Numeric arrays are passed by reference only if they are marked as [in,out] or [out] in the COM object's IDL file.
More information about the default behavior of the MATLAB COM Interface data conversion is available here:
MATLAB COM Client Support :: COM and DDE Support (Windows Only) (External Interfaces)