LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

import execution of matlab codes

I have never used matlab in my calculation.  

 

But, I have a matlab code (*.m) for calculating complex array after reading a file.

I intend to import the source file to Labview 8.6.

 

Does anyone know the best way of importing the code to Labview?

 

What's the limitation? (for example, limitation in the specific library of matlab)

Can I use all functions in matlab?

 

Do I have to install the full version of matlab?

 

How about speed in executing the code under labview?

(I have to calculate many data file and big array.)

 

labmaster.

0 Kudos
Message 1 of 2
(6,350 Views)
Hello,

LabVIEW ships with the MATLAB script node.  You can find it in the Mathematics >> Scripts & Formulas >> Script Nodes palette.  I am not aware of any limitations in using your existing code in this manner.  You do need to have The MathWorks, Inc. MATLAB® software installed in order to use the MATLAB script node.  There may be a slight delay in transferring your data to the MATLAB software from LabVIEW, but if your code is performing a large operation, the delay is negligible compared to your computation time.

Alternatively, you can use LabVIEW MathScript.  In LabVIEW MathScript, you generally can execute scripts written in the MATLAB language syntax.  However, the MathScript engine executes the scripts, and the MathScript engine does not support some functions that the MATLAB software supports.

The MathScript node can be used on your LabVIEW diagrams.  You can find it in the Programming >> Structures palette.  You can also use the interactive MathScript window to run code that you have created.  You can launch the MathScript Window from the Tools menu in LabVIEW.  By default, the MathScript search path uses your "My Documents\LabVIEW Data" directory.  If you place any of your .m files in that location, they will be found by MathScript.  LabVIEW MathScript does not require any third-party software to be installed.

The speed of execution largely depends on what your code does.  Using the MATLAB script node, the MATLAB software will execute your code.  LabVIEW MathScript is written on top of LabVIEW code, so it will never be faster than the equivalent operation in native LabVIEW code.  In general, if your code is vectorized and you don't see any warning glyphs on the MathScript node, your code should run decently fast.

MATLAB® is a registered trademark of The MathWorks, Inc.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 2 of 2
(6,338 Views)