LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Equation From an Array Based on String Equation Using Indexes

I have a 1D array that will have n inputs and would like LabVIEW to preform an equation on the array elements based on the location of the index numbers in a string equation. The issue is I have no idea where to start.

 

Example:

Array: [1,2,3,4]

String: "(0+1)/3+4"

Result: "(1+2)/3+4 = 5"

0 Kudos
Message 1 of 3
(3,159 Views)

Your example is a bit ambiguous.

 

String: "(a+b)/c+d"

 

Is this what you mean? By using the same characters in the string and in the array, you leave it open to several possible interpretations.

 

Look at the Eval Formula String.vi or Eval Single-Variable Array.vi in the Mathematics >> Script & Formula >> 1d & 2D Evaluation palette.

 

Lynn

Message 2 of 3
(3,139 Views)

Ahh, I hadn't thought about that issue. It looks like those .vi's will assist me in doing what I want. Thanks alot

0 Kudos
Message 3 of 3
(3,130 Views)