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

20 views (last 30 days)
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! :-)

Accepted Answer

Iain
Iain on 25 Sep 2014
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.

More Answers (2)

KANG
KANG on 1 Oct 2014
Edited: KANG on 1 Oct 2014
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 Comment
Iain
Iain on 1 Oct 2014
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"

Sign in to comment.


KANG
KANG on 9 Nov 2014
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!