LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficiently remove then append chunk of 2D array

Solved!
Go to solution

I have an array that is 72 rows (32 channels, 8 channels, 32 channels). I am trying to take the middle 8 channels and move to the end so it will be 32, 32, 8. I could delete a subset from the array then append to the end but I think that would cause 2 allocations. Was wondering if there was a more clean, inplace way of doing this?

0 Kudos
Message 1 of 3
(2,088 Views)
Solution
Accepted by topic author GregFreeman

Take 2 array subsets (32,8) (40,24) and then do two replacements into the original array (indices 64 and 32).  I find it is typically twice as fast as delete + rebuild (cleanest looking), which is twice as fast as the IPES (slowest and ugliest by far). Your mileage may vary.  It is all microseconds at that array size.

0 Kudos
Message 2 of 3
(2,078 Views)

Thanks Darin. Yes, it wasn't so much a matter of efficiency in this case, but general best practice.

0 Kudos
Message 3 of 3
(2,045 Views)