LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Math Interface Toolkit in Matlab: Can I interact with a VI as a parallel process

I'm curious if it's possible to create a Matlab MEX file using the LabVIEW Math Interface Toolkit (MIT) that can be called in matlab and accessed while running?

I'd like it to effectively work just like any other object in matlab.  I'd like to be able to query the object while it's running, dump values out of a buffer, and even hook events if possible.

As it currently stands, the VI to MEX setup seems to just allow me to call a VI, run it, and then drop out.  I want to be able to continuously acquire and access the data as it's coming in and interact with it from matlab (i.e. fully integrate the VI into my matlab code as a separate object).

Is this possible in some form or am I stuck with dedicating the matlab interface to the VI whenever I want to call it?

Thanks
0 Kudos
Message 1 of 4
(2,715 Views)

Hi GusLott,

I think the answer is you can do it, but I will need further clarification as to the problem.  Are you saying that you want to be able to collect data in MATLAB using MIT, but you want to continuously grab information?  If so then I think you need to break your VIs down to increase your functions.  Instead of having one VI that initializes, collects data, and then close, you break it into three VIs, and have 3 MATLAB calls.  You will need to have you collect data function inside of a while loop so that it continually pulls data into MATLAB.  More information would help in determining if it is possible?

Brian K.
0 Kudos
Message 2 of 4
(2,694 Views)
Mainly I want to know if I can treat a VI like an object in matlab that has properties and events and methods.  Can I call a VI and have it do its process while I interact with it programatically from matlab.

Currently, it seems that all I can do is call a VI and then click on it until it stops and then I can return to the matlab prompt.  VI execution seems to lock up the matlab command line until the VI is stopped.

I'd like to, for example, be able to have a VI actively controlling an experiment and dump data into matlab (via interrupts or some sort of buffer I could programatically access) for real time analysis.

0 Kudos
Message 3 of 4
(2,683 Views)
Hi GusLott,
 
You are correct that when you call a VI the command line will not continue until the output is obtained.  This makes sense since in LabVIEW that is how a VI operates (a subVI does not ouput until all outputs are obtained).  I believe this is also how commands in MATLAB work as well (correct me if I am wrong).  On the otherhand this is not a disadvantage in labVIEW since you can run VIs in parallel.  If you can create some way to run parallel threads in MATLAB then you will be able to do two (or more) MEX calls at once. 
 
As far as object oriented programming goes, there is a labVIEW OOP, but I do not think it has been tested in conjuction with the Math Interface Toolkit.
Brian K.
0 Kudos
Message 4 of 4
(2,673 Views)