Products & Services Solutions Academia Support User Community Company

Learn more about Spreadsheet Link EX   

MLPutVar - Create or overwrite MATLAB matrix with data from Microsoft Excel VBA variable

Syntax

MLPutVar ML_var_name, VBA_var_name 

ML_var_name

Name of MATLAB matrix to create or overwrite. "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.

VBA_var_name

Name of VBA variable whose contents are written to ML_var_name. Use VBA_var_name without quotation marks.

Description

Creates or overwrites matrix ML_var_name in MATLAB workspace with data in VBA_var_name. Creates ML_var_name if it does not exist. If ML_var_name exists, this function replaces the contents with data from VBA_var_name. Use MLPutVar only in a macro subroutine, not in a macro function or in a subroutine called by a function.

Empty numeric data cells within VBA_var_name become numeric zeros within the MATLAB matrix identified by ML_var_name.

If any element of VBA_var_name contains string data, VBA_var_name is exported as a MATLAB cell array. Empty string elements within VBA_var_name become NaNs within the MATLAB cell array.

Examples

Create (or overwrite) the MATLAB matrix K with the data in the Excel Visual Basic for Applications (VBA) variable DataK.

Sub Put()
    MLPutVar "K", DataK
End Sub

See Also

MLGetVar

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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