LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced formula parsing and arrays

I'd like to eval formulas with an array input, such as
y = x[i] + x[j] .....
This can be done normally with a Formula Node when the formula is static, but how about when the formula itself is an unknown string? None of the Advanced Formula Parsing VIs seems to fit.
0 Kudos
Message 1 of 5
(2,877 Views)
Your question is too general. You should give an example of what you want to accomplish.
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 2 of 5
(2,861 Views)

The question is way too generic to ba able to create a specific example.
I believe you could look at the example that is found in the following folder

labview\examples\math\math.llb\Behavior of Modified Function Graph.vi

which uses the formula parsing from string function.

Regards,

AlessioD

0 Kudos
Message 3 of 5
(2,856 Views)
INPUTS:
  • a C-like formula with an array argument of unknown size, y = f( x[ ] )
  • an array of doubles of unknown size, x[ ]

OUTPUT:

  • the result of the formula, y

 

EXAMPLE:

Input Formula (sums the elements of an array):

y=0;
int i;
for (i=0; i<N; i++)
    y += x[i];

Input Array (size N=3):

x = { 3, 4, 5 }

Output:

y = 12

0 Kudos
Message 4 of 5
(2,847 Views)
I don't think Formula vis (such as the  Parse Formula String vi) accept loop operators, although the formula node does.
 
In LV 8.0, you can use a MathScript Node, which uses a syntax similar to MathLab.
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 5 of 5
(2,838 Views)