05-14-2025 09:54 AM
Just wondering if anyone could possibly point me in the right direction, I know I am misunderstanding how the MeanPtBy.vi interacts in a shift register.
I am inputting an indexed array into a shift register to place through a "rolling average" and expecting an average. As the numbers in the array at present are static then the output should = the input array?
Would any one have any suggestions?
Solved! Go to Solution.
05-14-2025 10:18 AM - edited 05-14-2025 10:21 AM
05-14-2025 10:56 AM
Hi Altenbach,
Thank you for the reply.
I have made all of the suggested changes, reason for the not having the shift register was I have copied the code from my main program which had data, the blank array was me forgetting I hadn't set a default.
Please see the below and/or code.
I would be expecting the output to be 5,10,15,20 Not 5,7.5,10,12.5.
05-14-2025 11:10 AM
Cannot look at your VI (next time, do a save for previous, 2020).
You need to start with some basic tutorial, for example Rube Goldberg code such as the following is just plain silly:
Your array control is outside the loop, so the value in the shift register can never change, no shift register needed.
I cannot tell the size of your input array (container size != array size)
05-14-2025 11:17 AM
@Alex.902 wrote:
I am inputting an indexed array into a shift register to place through a "rolling average" and expecting an average. As the numbers in the array at present are static then the output should = the input array?
No. It should be the same result every time, that's true, but not the same as the input array.
05-14-2025 11:23 AM
Your array only has four points, so doing a five point rolling average seems pointless.
See if this can give you some ideas...
05-14-2025 03:58 PM
Thank you,
I see what you are saying although I have explained myself badly.
I am trying to make an array of constantly (in the main program) updating data and rolling average each column in the array with the next piece of data.
so in this instance it would be repeating 5,10,15,20. So averaging 5 five times 10 five times etc.
I don’t want to average the array instance itself but each individual number in the array with the next iteration from the loop that replaces the existing number.
Your example I think creates 200 random values feeds into an array then plots a rolling average of those values. In my example you would be feeding in a 2d array with 4 columns each of 200 values however I am looking for the average to be rolling dynamically as the data is acquired.
In my example I am just using the same digits looped rather than changing them each iteration to ensure the code worked.
as a practice example when doing a temperature calibration if doing 4 probes at once (due to being able to place 4 temps in a dry well against a reference) I would like the values being displayed to the user to be a rolling average of the data being acquired.
really appreciating the help.
05-15-2025 02:58 AM
You would need one PtByPt VI for each channel.
Alternatively, roll your own averaging using e.g. exponential smoothing
exponential smoothing multi channel