Example Code

Three Ways to do Mathematical Analysis in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

This document shows three ways to do a simple mathematical analysis using LabVIEW.  The three methods shown in this example are:

  • Using the LabVIEW Math libraries (simple example ODE LabVIEW.vi)
  • Using MATLAB Script Node (simple example ODE MATLAB.vi)
  • Using MathScript Node (simple example ODE MathScript.vi)

 

If you are interested in a comparison of some of these methods, particularly to see the differences between using the MATLAB Node and the MathScript Node, see this page: Moving to MATLAB Script Nodes from MathScript Nodes in LabVIEW

 

Hardware and Software Requirements

Required software for Windows:

  • LabVIEW 2018 (32-bit) or later
  • LabVIEW MathScript Module (32-bit) or later
  • MATLAB 2018a or later

No hardware required.

 

Steps to Implement or Execute Code

Installing the examples and setting the path in MATLAB:

Place the following three example benchmark VIs and supporting script (from the Example Benchmarks for MATLAB Script and MathScript zip file) into the Documents > LabVIEW Data folder on your Windows computer:

  • simple example ODE LabVIEW VI
  • simple example ODE MATLAB VI
  • simple example ODE MathScript VI
  • secondord.m

Also make sure that you add the path for the LabVIEW Data folder to your MATLAB environment on the same machine.

 

Running the example VIs:

You can run each example VI and observe the results.

 

Additional Information or References

MATLAB Script node

MathScript Module

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.