MLGetVar

Write contents of MATLAB® matrix in Microsoft® Excel® VBA variable

Syntax

MLGetVar ML_var_name, VBA_var_name 

ML_var_name

Name of MATLAB matrix to access. "ML_var_name" (in quotation marks) directly specifies the matrix name. ML_var_name (without quotation marks) is an indirect reference: the function evaluates the contents of ML_var_name to get the matrix name, and ML_var_name must be a VBA variable containing the matrix name as a string. var_name cannot be the MATLAB variable ans.

VBA_var_name

Name of VBA variable where the function writes the contents of ML_var_name. Use VBA_var_name without quotation marks.

Description

Writes the contents of MATLAB matrix ML_var_name in the Excel® Visual Basic® for Applications (VBA) variable VBA_var_name. Creates VBA_var_name if it does not exist. Replaces existing data in VBA_var_name.

Examples

Write the contents of the MATLAB matrix J into the VBA variable DataJ:

Sub Fetch()
MLGetVar "J", DataJ
End Sub

See Also

MLPutVar

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS