Solution
There are several options for importing/exporting data from the MATLAB® environment and LabVIEW.
The MATLAB® Script Node in LabVIEW
The
MATLAB® Script Node is a structure that is included with LabVIEW Full Development System for Windows as of LabVIEW 5.1. It can be found on the
Scripts & Formula VIs palette. The MATLAB® Script Node makes ActiveX calls to MATLAB® software from within LabVIEW. This requires that a valid license of MATLAB® be installed on the same machine as LabVIEW. Follow these step for
using the MATLAB® script node.
With the MATLAB® script node you can run the MATLAB® software programmatically from a LabVIEW program. You may enter the MATLAB® script in the node or import pre-existing MATLAB® code into the node.
MATLAB® Data Plugin
The
MATLAB® Data Plugin allows you to import and export level 4 and 5 MATLAB
® files, and directly read *.MAT files. As such, this is a great option for utilizing existing *.MAT data sets in LabVIEW, or creating data sets within LabVIEW that can then be utilized within MATLAB® software.
Data Transfer Options
NI has an
example program that allows a user to read LabVIEW generated TDM/TDMS files within The MathWorks, Inc. MATLAB® software. This example uses a TDM C DLL and an adapted C-header file that can be used in conjunction with MATLAB®.
For all versions of LabVIEW, data transfer between the two environments can be performed by saving the data in a file using the MATLAB® software and reading it directly from LabVIEW, or vice versa. In the MATLAB® environment, the
Save command allows you to save data in binary (*.mat) or ASCII format. On the reverse side, the
Load command allows you to read the data back into the program.
MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.