LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select some index of a 2-D array into two arrays?

I have a 2-D array with the value of 1 or 0. I'd like to find those elements with value of 1 and store their index of x-y into two 1-D array (or a 2-D array) respectively. I try to use 2 loops, compare each element with 1 and use the build array function, but it just doesn't work the way I want. Does anyone know a simple and fast way to do that?
0 Kudos
Message 1 of 4
(2,952 Views)
Here's how I would do it:
 
 
Just use the iteration of the outer and inner loops to determine the current index in the 2D array and thus, which row and column you're at.
 
Hope this helps,
-D

Message Edited by Darren on 04-05-2006 05:39 PM

Message 2 of 4
(2,945 Views)

This vi should do it.

 

Well Darren beat me to it....

Message Edited by tbob on 04-05-2006 04:42 PM

- tbob

Inventor of the WORM Global
Message 3 of 4
(2,943 Views)
Thank you! That's what I want!
0 Kudos
Message 4 of 4
(2,931 Views)