MLGetMatrix
Write contents of MATLAB matrix to Microsoft Excel worksheet
Description
Examples
Input Arguments
Tips
If data exists in the specified worksheet cells, it is overwritten.
If the dimensions of the MATLAB matrix are larger than that of the specified cells, the data overflows into additional rows and columns.
edat
must not include the cell that contains theMLGetMatrix
function. In other words, be careful not to overwrite the function itself. Also make sure the worksheet has enough room to write the matrix contents. If there is insufficient room, the function execution fails because the data has too many rows or columns. For details about the errors in the worksheet, see Worksheet Cell Errors.The
MLGetMatrix
function does not automatically adjust cell addresses. Ifedat
is an explicit cell address, edit it to correct the address when you do either of the following:Insert or delete rows or columns.
Move or copy the function to another cell.
If worksheet calculation mode is automatic,
MLGetMatrix
executes when you enter the formula in a cell. If worksheet calculation mode is manual, enter theMLGetMatrix
function in a cell, and then press F9 to execute it. However, pressing F9 in this situation may also execute other worksheet functions again and generate unpredictable results.If you use
MLGetMatrix
in a macro subroutine, enterMatlabRequest
on the line after theMLGetMatrix
command.MatlabRequest
initializes internal Spreadsheet Link variables and enablesMLGetMatrix
to work in a subroutine. Do not includeMatlabRequest
in a macro function unless the function is called from a subroutine.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