From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

split 2D Array by row

Has anyone ever split a 2D array by row, similar to split 1D array but for 2D?
 
What i mean is when you enter a given row number, it will split the array at that row.
 
Thanks-N-Advance
0 Kudos
Message 1 of 5
(3,795 Views)

Hi Fred,

Here's how I would do it...just a little trickery with Array Size and Delete from Array.  I'd be interested to see what approaches other people would take.  I'm thinking you could also do it with a couple of Array Subsets, but there might be more memory overhead with that approach...I'm not entirely sure...

-D

Message Edited by Darren on 03-15-200608:26 PM

Message 2 of 5
(3,793 Views)
Darren, you can do the exact same thing with no code other than Delete From Array simply by wiring 0 into the index input and the split index into the length input. The only difference is that the outputs would be reversed.

___________________
Try to take over the world!
Message 3 of 5
(3,777 Views)
This is how I would use array subsets.  Like Darren, I worry that it would not be very memory efficient for larger arrays.  Looking at the code, both you and I know that half the array is going to one subset and half is going to the other.  But I don't know if LabView knows that.  I suspect it makes a copy of the entire array on the off chance that the subarrays overlap.  Whereas the delete from array explicitly has two parts: the part that was deleted, and the part that wasn't.



Message Edited by jasonhill on 03-16-200608:26 AM

0 Kudos
Message 4 of 5
(3,763 Views)

Good call, tst...when I first read the problem, I thought it could be done with just a single Delete From Array, but I didn't think long enough about it, and went with the first thing that came to me.

-D

0 Kudos
Message 5 of 5
(3,747 Views)