08-05-2011 09:07 AM
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...
Solved! Go to Solution.
08-05-2011 09:13 AM
08-05-2011 09:27 AM
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
08-05-2011 02:09 PM
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.