LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter elements from a 2d array

Hi.
I need to remove all values below 10 from a (large) 2D array, but can't see how to do it.
Thanks
Mike
0 Kudos
Message 1 of 4
(3,595 Views)
There are many ways to do this depending on what you want. First of all though, reshape the 2D array into a 1D array, or index the 1st column and then 2nd separately as 1D arrays are easier to work with.

1) The easiest way is to sort the 1D array into ascending order, search for 10, and use the index to split the array, and then the second subarray os what you want. But this is no good if the array must be kept mixed.

2) Otherwise you can search for each element separately and delete from array, and even use the first subarray resulting from (1) as a list of elements to search for and delete.

3) Or simply, but slowly, index each element and delete it if it's lower than 10.
0 Kudos
Message 2 of 4
(3,595 Views)
You can't really remove individual elements of a 2D array, you must remove whole rows or columns. If you want to replace the values, wire the 2d array into a for loop and then compare each element and use the replace array subset function and a shift register.
>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 3 of 4
(3,595 Views)
You can try this Vi.
I don't think it's exactly you want but you can use the method


LANGE J.



"mw" a ?crit dans le message news:
5065000000080000003B4F0000-1023576873000@exchange.ni.com...
> Hi.
> I need to remove all values below 10 from a (large) 2D array, but
> can't see how to do it.
> Thanks
> Mike



[Attachment example.vi, see below]
0 Kudos
Message 4 of 4
(3,595 Views)