Example Code

Evaluate Equations Using 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

Overview

This VI allows you to evaluate equations with variables and formulas provided by the user

 

Description

This example allows you to evaluate equations using Parse Formula String.vi (Mathematics>>Scripts & Formulas>>Formula Parsing) and Eval Parsed Formula String.vi (Mathematics>>Scripts & Formulas>>1D & 2D Evaluation).

Parse Formula String analyzes a string as a formula and produces two numeric arrays, which can be used by the Eval Parsed Formula VI. Eval Parsed Formula VI takes the output and fixes input values to calculate function values (In this case Area of a circle). This is like the Formula Node but with variables and formulas that can be entered on the front panel by the user. In this particular VI, we are calculating the area of a circle when given the radius and value of Pi as inputs. This example shows how to enter simple equations in a string control and how to setup the Variables input, Input values, Formula, and output variable as well.

 

Requirements

LabVIEW Full Development System 2012 or compatible

  

Steps to Implement or Execute Code

  1. Enter the Variables Input, Input Values and Formula
  2. Run the VI

Additional Information or References

VI Block Diagram

Evaluate Equations LV2012 NI Verified BD.jpg**This document has been updated to meet the current required format for the NI Code Exchange. **

 

 

Scott G.
AE Specialist
National Instruments

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