MLPutVar
Create or overwrite MATLAB matrix with data from Microsoft Excel VBA variable
Description
MLPutVar
creates or overwrites matrix ML_var_name
, VBA_var_name
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
.
lets you catch errors when executing out
= MLPutVar ML_var_name
, VBA_var_name
MLPutVar
. If
MLPutVar
fails, then out
is a string
containing error code. Otherwise, out
is
0
.
Examples
Input Arguments
Output Arguments
Tips
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 byML_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 withinVBA_var_name
becomeNaN
s within the MATLAB cell array.To work with VBA code in Excel® with Spreadsheet Link™, you must enable Spreadsheet Link as a reference in the Microsoft® Visual Basic® Editor. For details, see Installation.
Version History
Introduced before R2006a