06-16-2010 01:54 PM
I have 1 element being read 10 times a second and I am trying to figure out how I can make a 1D array of this data for 5 min of data and after it is full I would like the old data to be replaced by the new data.
Can I get some ideas on how to do this? I am fairly new to labview.
Thanks for the help.
Solved! Go to Solution.
06-16-2010 02:39 PM
kjs356 wrote:I have 1 element being read 10 times a second and I am trying to figure out how I can make a 1D array of this data for 5 min of data and after it is full I would like the old data to be replaced by the new data.
Can I get some ideas on how to do this? I am fairly new to labview.
Thanks for the help.
Mulitple methods. One, you can use a functional global to initialize and update the array. Or, you can use an initialize array function to initialize the array to 3000 elements of empty strings. Then use insert into array or replace array subset to insert the data as you get it. Keep a counter wired to your array index and when that reaches 3000, reset it to zero. This will cause data to be overwritten. I'll draw up a quick example in a second.
06-16-2010 02:48 PM - edited 06-16-2010 02:49 PM
Use a queue. Set the queue length to 3000, then use the Lossy Enqueue Element function to place the most recent data at the end. The oldest element will be discarded, so you need to 'service' the queue faster than data arrives.
Servicing is a fancy way of saying use 'Dequeue Element' and do something with the data; write to a file, add to a chart, perform calcluation, etc...
Lossy Enqueue Element Function
06-16-2010 02:53 PM - edited 06-16-2010 02:53 PM
Well....since I already coded it I might as well post it. And don't use insert into array (that is not the functionality you want). My bad. Also, Philip's way is probalby better because mine will overwrite data starting at index 0. Therefore, the newest data will be "mixed" with the oldest.
06-16-2010 02:55 PM