LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

average of consecutive elements of array

Solved!
Go to solution

HI, i want to find the number of consecutive elements in array, calculate the average of each consecutive chunk,  Output should be tow arrays as shown in attatched image.

array2 shows the number of consecutive elements in each chunk.

array3 shows the average of consecutive elements in each chunk.

average of consecutive elements of array.png

0 Kudos
Message 1 of 3
(2,978 Views)
Solution
Accepted by topic author zeeshanhameed

Your average of 11,12,13 and 21,22  are incorrect.....

 

Use a For loop to iterate through the first array and use shift registers to keep an array of previous values in memory. Use this array of previous values to compare the current value with the previous. If there is a gap of greater than 1, output the average of the array and clear it. Write the newest value tot he shift register.

Here's what I mean: (It can be cleaned up a bit, but it works)

Example_VI.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 3
(2,974 Views)
Solution
Accepted by topic author zeeshanhameed

Thank you sir

0 Kudos
Message 3 of 3
(2,928 Views)