01-19-2024 07:51 AM
hi. I am a Labview beginner.
I am receiving signals from two channels through DAQ equipment and calculating the time difference (dt) in real time. I want to collect 6 values (dt) received like this and average them to show them.
I want to collect 6 values, show the average, initialize, collect 6 values again, and repeat.
Could you possibly help me?
thank you.
Solved! Go to Solution.
01-19-2024 08:59 AM
I don't like your block diagram.
It's ugly.
Zigzag wires everywhere.
You're supposed to care about the quality of your work.
Anyway, attached is an averager that I made a long time ago.
01-19-2024 09:35 AM - edited 01-19-2024 09:40 AM
This seems to be a continuation of your earlier thread (It would really help to keep everything in one place, or at least provide a link for context since the earlier thread is marked as solved!).
So from a set of two averaged arrays you get a singe scalar (dt) that you want to average over six iteration of you while loop, then start over. The easiest would be to use "Mean ptbypt" with a history of 6 and you will get continually the average of the last six points.
From a pure programming point of view, your array handling attempt is pure Rube Goldberg. Appending a scalar to an empty array will just give you an array with one point and that array will never grow. For that you need to keep the array in a shift register as we already do in the inner loop.
You could also use an inner FOR loop with six iterations, autoindex the dt at the output tunnel , and take the average there. There are many possibilities.
01-19-2024 11:23 AM
Here are some simplified ideas how to eliminate all that duplicate code...
01-21-2024 10:28 PM
I ran my block diagram with reference to your code, and if I set the window size to 10, it shows a value similar to the average before all 10 values are received. I wonder why.
01-22-2024 01:07 AM
The ptbypt Mean will average the data received so far until 10 points are available.