LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Realtime Array Building

Solved!
Go to solution

Hello,

 

I have a realtime acquisition that happens every 1/10 of a second (the loop fires about every 100ms)... I would like to continually build an array of 5 collected values and then send it off to another part of the program (produced consumed), and then zero the array and do it again, continually.

 

Any suggestions on how to do this? My example just seems to build an array of 5 of the current reading, not the last 5 readings... wondering if there is a way to only execute the loop on "consumed deque" (not sure if I'm saying that right).

 

thank you

downerdce_0-1652904914454.png

 

0 Kudos
Message 1 of 4
(226 Views)

downerdce_0-1652909692071.png

I solved it I think... changed it to a while loop instead of the FOR loop which was executing 5 times every while loop iteration.

0 Kudos
Message 2 of 4
(203 Views)
Solution
Accepted by downerdce

It is generally a bad idea to constantly resize arrays (does not matter too much with such small arrays, but it's a bad habit!)

All you need is an array initialize with 5 element where you replace the oldest and send it off whenver five have been replaced.

 

Here's a quick draft. Modify as needed.

 

altenbach_0-1652917208699.png

 

Message 3 of 4
(184 Views)

Thank you!

0 Kudos
Message 4 of 4
(123 Views)