Is it possible to use range objects with the MLGetMatrix function in Excel Link?

3 ビュー (過去 30 日間)
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))

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB Functions in Microsoft Excel についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by