09-03-2015 11:41 AM
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.
Solved! Go to Solution.
09-03-2015 11:45 AM - edited 09-03-2015 11:58 AM
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)
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-03-2015 08:30 PM
Thank you sir