Method Syntax error with control ActiveX. Error: The parameter is incorrect.
2 次查看(过去 30 天)
显示 更早的评论
I'm trying to use control ActiveX in Matlab for a Mint WorkBench controller. I'm trying to use method 'VectorA', that has the following syntax according to Matlab:
VectorA = void VectorA(handle, int16, Variant, Variant)
I've read that Variant data types in Matlab are trated as cells, so my code is like this.
% Connecting with controller.
h=actxserver('MintControls_5812.MintController.1');
invoke(h,'SetUSBControllerLink',2);
% Defining parameters
axes={0,1};
positions={-55.0, -60.0};
% Invoking method
invoke(h,'VectorA',length(axes), axes, positions)
and I get the following error:
Error using COM.MintControls__5812_MintController_1/VectorA
Error: The parameter is incorrect.
Error in VectorA_try (line 21)
invoke(h,'VectorA',length(axes), axes, positions)
According to Mint's help, its syntax in Visual Basic is:
VectorA(nNumberOfAxes As Short, nAxesArray As Object, fPosArray As Object)
I tried it in VB and worked perfectly. I also have tried other syntax ways for invoking the method in Matlab, like changing ordering, data type, passing some arguments like strings, and so on, and nothing worked. If I try handling the method as a property, like this:
set(h,'VectorA',length(axes), axes, positions)
My error is:
Error using COM.MintControls__5812_MintController_1/VectorA
Error: The parameter is incorrect.
Error in VectorA_try (line 22)
invoke(h,'VectorA',length(axes), axes, positions)
What is the correct syntax so the method works?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ActiveX 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!