LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass data to/from Matlab over ActiveX

I'm using an ActiveX server on Matlab to crunch some data from Labview.
I have figured out how to open and close a Matlab session from within
Labview, and how to send commands using the Execute on the Invoke node.

My problem is I cannot figure out how to use the "GetFullMatrix" or
"PutFullMatrix" to send and receive my data. I assume that Pr and Pi
are the real and imaginary parts of the parts of the array I assign to
the name I put in "Name", but have no idea what to connect to
"Workspace".

For "PutFullMatrix" I believe I wire my arrays directly to the OLE
invariant that pops up when I create a control. But for
"GetFullMatrix" I have no idea. Do I need to create the control AND
indicator for both Pr and Pi?

Any help would
be appreciated. (I am using LabView 5.1 and Matlab 5.2)

Thanks,

Scot
0 Kudos
Message 1 of 14
(5,902 Views)
Hi Scot,
maybe this link will help you ... http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/intro_ma.shtml#external_interfaces_guide
good luck
0 Kudos
Message 2 of 14
(5,899 Views)
Scot,

Instead of using ActiveX to communicate with MATLAB, you may want to try an easier route. LabVIEW 5.1 introduced the MATLAB Script Node, which is a way you can enter your MATLAB code directly onto your LabVIEW block diagram. This way, sending data to your code is very easy. You can find the MATLAB Script Node in the Mathematics >> Formula subpalette. Also, if you go to Help >> Search Examples >> Importing MATLAB Script you will find a few examples that should help you get started.

I hope this suggestion helps. Good luck with your application, and have a pleasant weekend.

Sincerely,
Darren N.
NI Applications Engineer
0 Kudos
Message 3 of 14
(5,899 Views)
Hi Scot and LabVIEW Supporters:

I'm new into Matlab-LabVIEW interfacing, I'm trying to pass some 2D array data from LabVIEW to Matlab Environment but I'dont have any documentation on how to use the ActiveX methods of the MLApp.DIMLApp class.

Do you have some examples on how to use the MLApp.DIMLApp methods and properties in LabVIEW?

Your help will be highly appreciated.

Thank you.


Felix Beltran

CONVERTEAM Ltd.
Control & Instrumentation Engineer.
Process Industries Department
0 Kudos
Message 4 of 14
(5,656 Views)
Felix,

Is there a specific reason you need to control MatLab using ActiveX methods rather than use the MatLab script node?  Another alternative is that in LabVIEW 8.2 there is a new feature called the MathScript node that accepts M-script style scripts and executes them directly in LabVIEW.
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 5 of 14
(5,646 Views)

High Dough:

Our LabVIEW 7.1 installationI doesn't have the MathScript Palette., is it free of charge?

I wanted to use ActiveX to pass data From LabVIEW To Matlab.

Our Customer (Steel Industry) uses Matlab to Analyse data files from production which are created by an old Data Acquisition system on site.

We have built a new data acquisition system for them based on National Instruments Hardware and Software. The Data logger is an executable built on LabVIEW 7.1 which logs data from differents sources (Analogues and Counter Cards, OPC, Reflective Memory, EGD -Ethernet, Profibus ect..). Now they want to  read the new data files in Matlab as they used to do it with the old Data Logger.

The inconvenient is that those new data files are compressed binary files. So instead of writing a script in Matlab which read the files, decompress the data (inflate) and pass it over the Matlab Workspace I wanted to use a LabVIEW program (executable) that I already got to do this job. The only thing I'm missing is passing the decompressed data array (2D) from the LabVIEW executable to the Matlab workspace and for that I though I might use ActiveX access to Matlab.

That is why I want to know how to use the Matlab ActiveX Class Methods and Properties in LabVIEW.

Your feedback will be highly appreciated.

Thank you

Felix.

 

 

 

 

 

0 Kudos
Message 6 of 14
(5,630 Views)


@Felix Belt wrote:

Our LabVIEW 7.1 installationI doesn't have the MathScript Palette., is it free of charge?






It is included with LabVIEW 8.x , but there is no MathScript in LabVIEW 7.x.
0 Kudos
Message 7 of 14
(5,621 Views)
Hi Felix,

The Matlab Script Node is available on the Analyze»Mathematics»Formula palette.  It allows you to enter an m-file script in LabVIEW and it uses ActiveX technology to pass the m-file script to Matlab running on the same machine.

If you want to use other more advanced functionality of the Matlab ActiveX API, I unfortunately don't have any experience there.  If your questions are about using ActiveX in LabVIEW in general, there are many resources here on our website regarding ActiveX use -- simply type "activex LabVIEW" into the search field on ni.com.
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 8 of 14
(5,616 Views)

Hello All.

I am also attempting to use the activex API calls to interface with Matlab. I have had some success getting the 'execute' and 'getvariable' methods to work, but I am unsure of how to convert the variant data that is returned from Matlab when I want to retrieve an array of data. When I try using the 'variant to data' vi I get a "data type mismatch" error. I am hoping that even someone who doesn't have much experience with the activex will know something about dealing with the variant data.

Thank you

Ryan

0 Kudos
Message 9 of 14
(5,276 Views)
As repeated in the other messages in this thread: is there some reason you can't just use a Matlab script node rather than dealing with the ActiveX API calls directly? Also, what type of data are you trying to return?
0 Kudos
Message 10 of 14
(5,272 Views)