LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Average of multiple array elements

Solved!
Go to solution

I have 5 arrays of equal length, and I would like to take the average of each element and create a new single array of these average....ie average all 5 array element 0, average of all 5 element1, average of all 5 element 2 etc and write this to a new array.

 

I have tried the attached but without luck.

0 Kudos
Message 1 of 5
(3,839 Views)

Broken wires and the evaluation watermark makes it hard to see what is really going on.

 

You need a loop.  Try wrapping a For Loop around the Build Array and Mean functions.  Turn on auto-indexing tunnels for the 5 arrays going in and 1 array going out.  A For Loop with indexing tunnels is like a "For Each Element in Array" implementation.

0 Kudos
Message 2 of 5
(3,837 Views)

I tried that, it only created a numeric indicator on the output and not an array. Here is the code I have in place.

 

 

0 Kudos
Message 3 of 5
(3,824 Views)
Solution
Accepted by topic author CastleWorks

Delete the scalar indicator.

Make all 6 tunnels auto-indexing.

Right click, Create Indicator on the output tunnel from the For Loop.  Now you have an array indicator.

0 Kudos
Message 4 of 5
(3,822 Views)

Thanks for the help, that did it.....it would not create an array indicator until I deleted the wire coming from the Mean VI and re ran it to the tunnel....essentially recreating it.....then it gave me the option of creating an array indicator.

 

Thanks!

0 Kudos
Message 5 of 5
(3,778 Views)