DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicating with MATLAB

I tried inserting the full path on line 37 but I am getting the same errors.

 

In Matlab, I would follow similar logic as you described in your last message. In Matlab, there is a textbox where I would specify the directory of the m script. Then I would type the filename on the command prompt and then it would work. Alternatively, i can type the whole file name (with path) on the command prompt and matlab would stil run it. 

 

0 Kudos
Message 11 of 17
(1,521 Views)

Hi Neuropotential,

 

I don't know why the ActiveX call to MatLab to run the m script file is failing.  Have you tried running ActiveX calls to MatLab from any other programming language (C, VB, Java, LabVIEW)?  It would be interesting to know whether the your MatLab version's ActiveX server is functioning properly.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 12 of 17
(1,507 Views)

No. I have not called MATLAB through any of the code which I wrote. But, there are other applications on my computer which communicate with MATLAB (Eg: Comsol; SCIRUN). But I am not sure if they do it using Active X.

 

Is there any way by which I can verify if the Active X is properly installed to communicate with MATLAB? Can I reinstall Active X again; just to be sure? Also, when I run the VB Script, I can see the one MATLAB window opening up but it closes after some time. 

0 Kudos
Message 13 of 17
(1,504 Views)

Hi Neuropotential,

 

I'm suggesting that you try to send similar ActiveX commands to MatLab from some programming language other than VBScript to remove DIAdem from and VBScript from suspicion.  Can you write a 10 line program in some other language to connect to MatLab via ActiveX and send and "Execute" command?  Or do you know someone who could do this for you?  There is no way to "install or re-install ActiveX".  It is possible that MatLab's ActiveX server is not funcitoning properly, and it is also possible if this is the case that re-installing MatLab might help, but these are both low percentage options.  I'd rather test the existing ActiveX server independently, because chances are MatLab's ActiveX server is fine and re-installing MatLab wouldn't change anything.

 

The fact that the MatLab icon appears in the system tray when you run the DIAdem VBScript is encouraging, that means that the ActiveX connection to MatLab is probably succeeding.  If that is the case, then there must be something wrong with the ActiveX commands that are being issued to that connection.  It's also possible that the connection that gets created is somehow wounded and unable to accept commands.  I can't tell from here based on the info you've given me so far.

 

Have you tried any of this on another computer?

 

Sorry this is so much trouble, it usually just works,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 14 of 17
(1,488 Views)

Thank you for your reply. I do not have any experience in using ActiveX commands to connect to MATLAB. Also, I am stationed in Medical College, so finding someone here would be a problem. I will keep checking. If you have any good reference where I can learn to use ActiveX to communicate with MATLAB, I will be willing to give it a try.

 

I will have to verify how feasible for me is to reinstall MATLAB again, since different software are dependent on it and I would not like to mess their communication path. Also, there are external toolboxes which I have installed over time which I have not being keeping track.

 

I will try and install it on other computer and see if DIAdem communicates.  I will contact you in next week with some updates. 

0 Kudos
Message 15 of 17
(1,483 Views)

Hi Neuropotential,

 

I would definitely reserve the MatLab reinstall as a last resort.  As for ActiveX programming, it's really remarkably simple in VBScript-- here's the sequence of commands:

 

Set oMatLab = CreateObject("MatLab.Application")

Call oMatLab.Execute("MatLab Command to Execute")

Set oMatLab = Nothing

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 16 of 17
(1,469 Views)

An old thread, but maybe someone find it helpful.

In my configuration (Matlab 2014, Diadem 2012) I had to repair following lines of code in the example.

 

Original code: 

Call oMATLAB.Execute("Addpath '"&AutoActPath&"'")

Call oMATLAB.Execute("MatLab_FFTTest1")

 

Repaired:

Call oMATLAB.Execute("addpath '"&AutoActPath&"'")

Call oMATLAB.Execute("run('MatLab_FFTTest1.m')")

 

Matlab is case sensitive, correct function is addpath(), not Addpath() and I had to use the Matlab function run() to execute the m-script.

 

Tomas Censky

0 Kudos
Message 17 of 17
(1,027 Views)