Example Code

Evaluate Equations Using Parse Formula Node.vi and Eval Parsed Formula Node.vi.

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 example demonstrates how to parse a string of formulas and calculates the variable values.

 

Description

This example shows how to evaluate equations using Parse Formula Node.vi (Mathematics>>Scripts & Formulas>>Formula Parsing) and Eval Parsed Formula Node.vi (Mathematics>>Scripts & Formulas>>1D & 2D Evaluation).  This is similar to the Formula Node but with variables and formulas that can be entered on the front panel.

In this particular VI, the area of a circle when given the radius and value of Pi is calculated.  This example shows how to enter simple equations in a string control and how to setup the input variables, input values, and output variable as well.

 

Requirements

 Software

  • LabVIEW Full Development System 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached file
  2. Run the program

 

Additional Information or References

Calculate and Parse Formulars LV2012 NIVerified.vi - Front Panel.png

 

Calculate and Parse Formulars LV2012 NIVerified.vi - Block Diagram.png

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

Scott G.
AE Specialist
National Instruments

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

Comments
jlguthri
Member
Member
on
The 4th find/replace block needs to have the top bools wired.... otherwise, it don't count the number of formulas right, when you add additional ones...