LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview and Matlab inferfacing with each other

I currently have Labview Mathscript RT Module that allows me to insert my matlab script into my labview program, but the problem I’m having now is the mathscript module isn’t able to run the Simulink file I have. Currently my matlab script runs and saves some variables, then calls the Simulink module inside of it and returns to the matlab script to continue to run, then it gives my labview program the final outputs from the matlab script.

 

So my question is how should I go about editing the matlab script? Or is there a module I could download that would allow me to just call it directly from my mathscript RT module.

0 Kudos
Message 1 of 5
(2,929 Views)

You need Simulation Interface Toolkit, http://sine.ni.com/nips/cds/view/p/lang/en/nid/209048.

0 Kudos
Message 2 of 5
(2,920 Views)

In order to work with Simulink® models in LabVIEW, KateB is correct that you will need Simulation Interface Toolkit. I just wanted to give you a bit more information. You can find an example of how this toolkit works in this document, http://www.ni.com/white-paper/3057/en/ . Also, in LabVIEW 2013 and later the Simulation Interface Toolkit has been replaced by the Model Interface Toolkit. 

 

I hope this helps!

 

Simulink® is a registered trademarks of The MathWorks, Inc.

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 3 of 5
(2,886 Views)

The problem with importing my simulink module to labview is that the matlab script calls the simulink module inside a for loop. and keeps doing this continuous exchange and updating of variables inside the workspace, so I want to keep it as is. So I wanted to know if the mathscript RT module understands that when I call the simulink it should run a simulink module I made, or do I have to direct it to where that module is?

 

Also the simulation interface toolkit has been replaced with the LabVIEW Model Interface Toolkit. Is there anything really different with how they work?

 

I also tried converting my simulink module to labview using another module I downloaded but it makes around 10 subVIs, yet it doesn't wire them together. Basically I have 10 subVIs that aren't talking with each other, or I don't know if labview knows that after I do this one subVI I jump to this next one, etc.

0 Kudos
Message 4 of 5
(2,863 Views)

The Mathscript RT node does not actually run code in MATLAB®, but simply runs m script code. If you look in the help for the Mathscript RT Module there is no function call listed to open and run Simulink®. You may be able to accomplish this task using the MATLAB® Script Node which uses ActiveX to call MATLAB® software. If you'd like to try this you can find this node under, Functions >> Mathematics >> Scripts & Formulas >>Script Nodes. 

 

You can find some more information about the Model Interface Toolkit and it's new features here, https://decibel.ni.com/content/groups/product-pulse/blog/2013/10/07/adieu-labview-simulation-interfa... or on it's product page. 

 

MATLAB®, and Simulink® are the registered trademarks of The MathWorks, Inc.

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 5 of 5
(2,840 Views)