How do I access individual elements of a matrix returned by a MATLAB COM object to Visual Basic?
1 次查看(过去 30 天)
显示 更早的评论
I have a MATLAB COM Builder generated object and I am trying to access the values of a returned matrix in Visual Basic.
For example:
Dim load As Variant
Call MatlabObject.myFunct(2, load, score, msparseX, 1#)
The MATLAB function declaration is
[load, score] = myFunct(X,numEle)
If I attempt to acess the individual values of "load" with the Array property I receive the error
"Let procedure not defined"
This puzzles me because I can access the individual values of the input array msparseX.Array(1) without any difficulty.
采纳的回答
MathWorks Support Team
2009-6-27
The msparseX works because it is a MWSparse object and has the Array property defined for accessing the nonzero array values of the sparse array. However, since the "load" variable is simply a VARIANT array, you have to index into it directly as in:
Call oMatlabObject.myFunct(2, load, score, msparseX, 1#)
load(1,1)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Use COM Objects in MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!