Actxcontrol - data transfer to an instrument
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I need a help regarding a format for a variable to transfer input data to my instrument.
I am trying to communicate via ActiveX with my instrument (Raman microspectroscope). When I enter
LabSpec = actxcontrol('NFACTIVEX.NFActiveXCtrl.1', [15 15 410 390]);
LabSpec.invoke
It says
PutValue(handle, int32, ustring, Variant(Pointer))
Given this, when I enter
PutValue(LabSpec, 0, 'ShutterMode', 1)
It says
Error using COM.NFACTIVEX_NFActiveXCtrl_1/PutValue
Error: Type mismatch, argument 3
I think the last argument was incorrectly inserted. If I need to give "1" (for the argument 3) to the instrument, what type of variable should I use for "Variant(Pointer)"?
Anyone has a good suggestion?
Thanks!
Kang
6 个评论
Mario Malic
2021-2-14
Hope you have already resolved your issue.
I encountered an example of documentation that you need, unfortunately not for the same program, just so you can see that you really need to find (maybe it exists in the program manual).
https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.saveas, If you take a look at FileFormat, see the description that'll lead you to another link with so many different inputs that do different thing.
回答(1 个)
Pratheek Punchathody
2021-2-16
As a workaround to this, If the control does not have UI interaction involved, you can load the control using 'actxserver' in invisible mode and call its properties and methods on your demand. The difference between 'actxcontrol' and 'actxserver' is there will be no figure window. But you are still able to get a handle of control in MATLAB. For more details with 'actxserver',
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!