From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

How to take an average every 26 samples in an array of 219 elements?

Go to solution

Hello to every one,


Well the problem i have is that i am having an array of 219 elements and every 26 elements i want to take an average.Can please someone suggest a code solution for that?

0 Kudos
Message 1 of 7
Accepted by topic author gtathatos

Hi gstathatos,


here's a suggestion:


Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7

Asuming you want the average of the 26 sample sets you need to wire the Length in Gerds example also.


G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
0 Kudos
Message 3 of 7



while your suggestion is really good (scalable, well written), you are missing imho one wire: The length of each "chunk" should most probable be 26!



Another question which comes to my mind is:

Gerds suggestion chunks the array , so you will get 219/26 = 8 chunks. Each chunk should most probable suffix to the the previous one without having overlapping. Please verify this.

The other option would be to have a "moving average".


hope this helps,


CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 7

A slightly modified version of GredW's code.




(I always like to play with array :))


The best solution is the one you find it by yourself
Message 5 of 7

Hi Gerd,


Your suggestion code work as i expected and many thakns for that.

0 Kudos
Message 6 of 7

Hi to all,


yes, I forgot to wire the "Length" input of the ArraySubset function. But this was noticed easily...


@P Anand:

Using DeleteFromArray is forcing shuffling of the array content. Using ArraySubset should be more memory-efficient (and probably faster for big arrays).

Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7