How does matlab handle activex variant function calls?

3 次查看(过去 30 天)
I am calling an activex control that interfaces with a usb device. I can get as far as to see the function calls but I can't seem to get data back and forth like I do in python. The first thing I do is pass in text of the usb device id and then I get a handle string back that I pass into the openpipe function, then I can access the usb device via the read functions. In matlab it returns an NAN when I try GetConnectedDevices. In python it has to build a com wrapper file to translate the data, is matlab not translating the data it gets back right?
>> device = actxserver('USBommited.ommited.1'); >> invoke(device) GetConnectedDevices = Variant GetConnectedDevices(handle, string) OpenPipe = uint32_T OpenPipe(handle, string) ClosePipe = void ClosePipe(handle) ReadPipe = [uint32_T, Variant(Pointer)] ReadPipe(handle, uint32_T) ReadPipeBytes = Variant ReadPipeBytes(handle, uint32_T)
>> iscom(device)
ans =
1
>> ismethod(device,'GetConnectedDevices')
ans =
1
>> device.GetConnectedDevices('CC476332-BBC1-4737-8376-B237C00199C0')
ans =
NaN
>>
  1 个评论
Steven
Steven 2015-1-26
>> invoke(device)
GetConnectedDevices = Variant GetConnectedDevices(handle, string)
OpenPipe = uint32_T OpenPipe(handle, string)
ClosePipe = void ClosePipe(handle)
ReadPipe = [uint32_T, Variant(Pointer)] ReadPipe(handle, uint32_T)
GetDeviceDescriptor = [uint32_T, Variant(Pointer)] GetDeviceDescriptor(handle, string)
GetStringDescriptor = [uint32_T, string] GetStringDescriptor(handle, string, char, uint16_T)
GetParentDeviceInstanceID = string GetParentDeviceInstanceID(handle, string, string)
ReadPipeBytes = Variant ReadPipeBytes(handle, uint32_T)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile 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!

Translated by