12-23-2014 01:46 PM
Im trying to write an table of arrays but the data writes from the top to bottom I want it write the newest data to the top is there a way to do this?
12-23-2014 01:52 PM
Flip your inputs to the Build Array function. Right now, you're putting the old data on top and the new line on bottom. Instead, put the old data into the bottom input so the new data is inserted first.
12-24-2014 05:16 AM
12-24-2014 07:12 AM
You need to use a shift register. I have provided an example.
Hope this helps.
12-24-2014 11:11 AM
If it is a 1-D array, and you already have the entire array (with the newest element last), simply use the Reverse 1D Array function.
BS
12-24-2014 11:43 AM
@Marty_H wrote:
You need to use a shift register. I have provided an example.
Hope this helps.
Look at his code next time. He provided an example with a shift register as well.
If you're interested in performance, ignore parthabe's advice. What he suggests will work, but it'll be nasty for performance. You're better off doing what you're doing now and then using the Reverse 1D array Bob suggests at the very end of your program. (If you do it in each iteration, you'll get one jumbled mismatch of the order of your data.)
12-24-2014 12:42 PM
natasftw wrote:
If you're interested in performance, ignore parthabe's advice. What he suggests will work, but it'll be nasty for performance. You're better off doing what you're doing now and then using the Reverse 1D array Bob suggests at the very end of your program. (If you do it in each iteration, you'll get one jumbled mismatch of the order of your data.)
Agreed. But the OP says "Table of arrays", so I think it should be a 2D array & the data set he wants to insert at the top is a 1D array (maybe a row). In this scenario, I think your first reply appeals to me as the best solution - "Flip your inputs to the Build Array function". 🙂
P.S.:- I do not have the LV ver in which the VI is posted, so cant see the code.
12-24-2014 01:17 PM
I meant the "open his code" piece for the person I quoted. It made no sense to me to tell the guy to use a shift register and post an example of this when the code already used a shift register so clearly that wasn't helping on its own.
Even working with a 2D array, I'd want to avoid inserting to the front of the array for performance reasons. As crazy as it may sound, it's usually faster to reverse the entire array, place the item at the end, and reverse the entire array a second time than it is to insert it into the front. If performance doesn't matter, it's much prettier to just insert it at the front. It's really up to design at that point.
12-25-2014 02:13 AM
But how'd you revert a 2D array? There is no direct method/function available within LV. One can only transpose it. Or, is there any OpenG function that does this?