From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating MATLAB into labview

 
Hi, i'm having a Matlab set of scripts that i need to integrate into LabVIEW. I saw there's the function "MATLAB SCRIPT". I try to write into it something like "run script" where script is the name of the Matlab script, but i'm having issues with it, i'm not a pro nor of labview, nor of matlab, and I think the problem could be that or labview or matlab doesn't understand where is the script. Where should i place the script to make the thing work?


Thanks for the help.

0 Kudos
Message 1 of 4
(3,469 Views)

When you are starting to learn how to use LabVIEW, the best idea is to use the Example Finder (menu Help >> Find Examples...) or just browse the shipping examples (C:\Program Files (x86)\National Instruments\LabVIEW 2015\examples\).

 

Now, about your question, I would advice to try to open the following example:

C:\Program Files (x86)\National Instruments\LabVIEW 2015\examples\Mathematics\Scripts and Formulas\MATLAB script node - Fractal.vi

 

If you have LV 2014 or Lv 2016, just adjust the year on the path.

 

As you can see in this example, you do not need to "run script". When you run the LabVIEW VI that has the "matlab script", this will get the script inside the node, transfer it over, execute and get the results and bring it back into LabVIEW. Look into help for more information.

 

Now, if you do not mind adapting your script, I would advice you to look into the other nodes in LabVIEW that could do what you want (of course, it all depends of what you have on your script).

 

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 2 of 4
(3,431 Views)
 
thanks for your answer, the problem is that i'm working on a very HUGE set of scripts, around 1400 lines each that i did not write on my own, so i was asking myself if it was possbile to keep them all together into matlab, else i'll do a copy-paste using that function, thanks.
0 Kudos
Message 3 of 4
(3,413 Views)

I believe you can just use the "run" command inside the Script Node (not Mathscript). This should run the script.

 

However, maybe the best would be to convert your script to functions (or use the create a function that runs the command above) and then call that from the Script Node. That is the most cleaned way to encapsulate the script (and you can standardize the inputs and outputs of it) and, most importantly, other people could change the other files as they need.

 

Hopefully this helps.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 4 of 4
(3,396 Views)