Is it possible to use range objects with the MLGetMatrix function in Excel Link?
3 views (last 30 days)
Show older comments
I am using the Excel Link MLGetMatrix function in an Excel Macro, but I need to use use a range object returned by the VBA Cells function to specify where to place the data.
For example instead of:
MLGetMatrix "X", "Sheet1!A1"
I would like to use:
MLGetMatrix("X",Cells(1,1))
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
The MLGetMatrix function can accept ranges expressed as strings; to use a range object, you will first need to convert it to string format.
The MLGetMatrix function in Excel Link takes two string inputs. The first input specifies the MATLAB variable name and the second input specifies the address of the Excel worksheet cell where the first element of the MATLAB variable should be written.
If you have a range object which refers to the location where you want to write your data, you can use the "Address" property of the range object to extract the string. For example:
Sub Get_Variable()
MLGetMatrix "X", Cells(3, 2).Address
MatlabRequest
End Sub
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Functions in Microsoft Excel in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!