04-25-2014 02:03 PM
I want to take a rolling average of values that are output from a scale. I want the data being indexed into an array as such that it only remembers the last 50 values. I then want to take the mean of the 50 values to get my output.
The way I have it designed now is that it does average the last 50 values, but instead of just filling in a new value in the next index slot, it sets all of the values back to zero when it gets 50 iterations. This causes my scale to increase the average for 50 values, and then reset to zero and do it all over again. The way it is wired up now, this is what's happening.
04-25-2014 02:13 PM
I highly recommend using the Mean PtByPt VI.
04-25-2014 03:05 PM
04-25-2014 03:50 PM - edited 04-25-2014 03:52 PM
First of all, you should attach your VI instead of cropped pictures.
As others have said, using mean ptbypt is the correct tool here, if you want to create your own, have a look here (same result, but maybe you can learn something ;)).
(compare ptbypt mean and simple code equivalent)
Some general code review comments: