How Can I Run a MathWorks, Inc. MATLAB® Script That Uses MATLAB® Toolboxes in LabVIEW?

Updated Sep 5, 2023

Reported In

Software

  • LabVIEW MathScript Module
  • LabVIEW

Issue Details

I am trying to execute a code I have written in MATLAB® on LabVIEW with the Mathscript Node, but some functions are not recognized, and the node throw me errors.
What should I do?

Solution

The reason why it is not recognized is that you must use, in this case, the MATLAB® Script Node (right) rather that MathScript Node (left).
MATLAB® Script Node in LabVIEW uses ActiveX to call the MATLAB® runtime system while LabVIEW MathScript RT Module runs separately from The MathWorks, Inc. MATLAB® software.

You can find the MATLAB® Script Node in Mathematics >> Scripts & Formulas >> Script Nodes :







 

Additional Information

It is also possible to call the the MATLAB.exe, or a built executable, from LabVIEW using the System Exec VI.

Note: NI no longer offers the LabVIEW MathScript Module, and LabVIEW MathScript Module functions are not recommended for new designs. See www.ni.com/migratemathscript for information and recommended alternatives.