LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I keep the last 5 test results as the test continues?

Solved!
Go to solution

Hello,

 

I have a test requirement where I need to run a series of motors to either failure or some large number of runs, each for a short period of time. I will measure the current draw of each run. I need to only keep the last 5 readings of each motor. How do I roll the array to just keep the last 5 readings?

 

Where's my aspirin...Smiley Sad

0 Kudos
Message 1 of 4
(2,579 Views)
Solution
Accepted by topic author slipstick

 

Hi slipstick,

 

these are the main steps:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,573 Views)

Hello,

 

If you do not need to close VI in between runs, the best way is first create empty array, then each run you insert the newest data to the beginning of array, and then you take the 5-items long subarray from the array you added the newest value. This subarray in the array with last 5 values you want.

 

But if you need to close VI in between runs, all you need to add to previous program is to read a file at the beginning and write a file at the end.

 

If you will have any questions regarding implementation feel free to ask.

 

Best Regards,

Gregor Cerne

0 Kudos
Message 3 of 4
(2,564 Views)

Don't sleep on the 'Data Queue PtByPt.vi' and its complex cousin.  Like most PtByPt VIs it basically slaps together a First Call? primitive, a While loop and a few shift registers.  In this case I am pretty sure it is wrapping up the Rotate Array method GerdW showed, but I haven't looked under the hood in a long time.

0 Kudos
Message 4 of 4
(2,544 Views)