'Typecasting' COM-objects in matlab?
이전 댓글 표시
Is it possible to typecast COM objects in matlab, as would be done in C# for instance?
I am using a COM dll (actxserver).
The code in C# of what I want to do is:
var m = tracker.Measurement.MeasureStationary() as StationaryMeasurement3D;
The object returned by 'tracker.Measurement.MeasureStationary()' is not of type 'StationaryMeasurement3D', but can be cast to it.
I've tried using the cast() function in matlab, but returns with the error 'Unsupported data type for conversion'.
답변 (1개)
Guillaume
2015년 10월 9일
0 개 추천
Use invoke to get access to a different interface implemented by the com object. The list of interfaces implemented by that object can be obtained with interfaces.
댓글 수: 3
Joris Janssenswillen
2015년 10월 12일
It may well be a limitation of matlab in which case I'm not sure there's any workaround (short of rewriting the com object).
Note that the documentation states that "custom interfaces are not supported on a 64-bit version of MATLAB". I've not got a 32-bit version installed anymore so can't really do any testing. It's also been a while since I've dealt with COM since I never bothered upgrading my COM components to 64-bit.
Is there a way to access the com interface you want through an IDISPATCH interface (obtained via a property of the object)?
Joris Janssenswillen
2015년 10월 13일
카테고리
도움말 센터 및 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!