Make a connection between MATLAB-VISUAL BASIC via ActiveX as a bridge,

11 次查看(过去 30 天)
Hi,
I am trying to control LabSpec6 using external software, MATLAB. LabSpec6 is the specific software of Raman instrument (Horiba Corp.) and it has a Visual Basic (VB)-based script option. I think I have succeeded to make a connection between LabSpec6 – MATLAB (R2014a 32-bit) via ActiveX as a bridge, however, it seems that LabSpec6 does not respond to MATLAB commands.
In detail; 1. I could see the functions (methods) which are similar to those used at LabSpec6 VB script. This makes me think that I have succeeded to make a connection between LabSpec and MATLAB.
2. For the test, I ordered simple commands;
>> LabSpec=actxserver('NFACTIVEX.NFActiveXCtrl.1');
>> LabSpec.Acq(0,1,1,0,0)
However, nothing happened and MATLAB fell into a dumb status (in endless ‘Busy’ condition).
3. Moreover, there was a flaky result when I made a command;
>> get(LabSpec)
struct with no fields.
Do you guys have any sense on this?
Thanks in advance! :-)

采纳的回答

Iain
Iain 2014-9-25
Using activeX is a bit of a pain. HOWEVER, if you look at the code for xlsread/xlswrite, you'll see that there is a whole load of activeX stuff where matlab tells excel to do things that look remarkably like visual basic (for applications) commands. You can use that code as a leaping off point.
To explain #2 - Your command was issued to LabSpec, but labspec never finished doing whatever you asked of it. This made Matlab just simply wait.

更多回答(2 个)

KANG
KANG 2014-10-1
编辑:KANG 2014-10-1
Hi lain,
Thanks for your reply. By the way, I became to know that LabSpec ActiveX was registered to MATLAB with strange file name.
'C:\HORIBA\LABSPE~1\REGISTER\COMMON\NFACTI~1.OCX'
It should be registered as this file
'C:\HORIBA\LABSPEC_6_2_69\REGISTER\COMMON\NFACTIVEX.OCX'
Is there anyone who knows how to fix this?
Thanks in advance!
  1 个评论
Iain
Iain 2014-10-1
That shouldn't need to be fixed. Windows maintains a "short" filename which is in the old DOS 8.3 format.
LABSPEC_6_2_69 is longer than the 8, so it got shortened to "LABSPE~1"
NFACTIVEX.OCX is longer than the 8, so it got shortened to "NFACTI~1.OCX"

请先登录,再进行评论。


KANG
KANG 2014-11-9
Hi qimao,
Since I could not find the way to reach you, let me use this webpage (hopefully, you will find this!). My answer is,, this issue has been partly solved, but I am still doing something! If you could describe more details, we can discuss about this together.
Thanks!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by