LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing arrays to a table but I want newest data in first row how do I do it?

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?

0 Kudos
Message 1 of 9
(4,344 Views)

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.

0 Kudos
Message 2 of 9
(4,341 Views)
"I want it write the newest data to the top" Insert the data at the 0th index of the existing Table (= 2D Str Arr).
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 9
(4,292 Views)

You need to use a shift register.  I have provided an example.

 

Hope this helps.

0 Kudos
Message 4 of 9
(4,280 Views)

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

0 Kudos
Message 5 of 9
(4,261 Views)

@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.) 

0 Kudos
Message 6 of 9
(4,247 Views)

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.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 7 of 9
(4,230 Views)

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.

0 Kudos
Message 8 of 9
(4,225 Views)

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?

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 9 of 9
(4,195 Views)