LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find row in 2d array

Solved!
Go to solution

please help...

 

i have 2d array of double and i wanna find specific row an extract to new 2d array.

 

My 2d array is:

 

100 31,3 25,3 32,1 25,6
100 31,3 25,3 32,1 25,6
160 32,4 25,5 33,5 26
170 33,2 25,8 34,3 26,2
100 33,9 26 35,2 26,4
160 32,4 25,5 33,5 26
160 32,4 25,5 33,5 26
100 31,3 25,3 32,1 25,6
170 33,2 25,8 34,3 26,2

 

 

and i wanna find row with numbers 100,160,170 and build new 2d array

 

100 31,3 25,3 32,1 25,6
160 32,4 25,5 33,5 26
170 33,2 25,8 34,3 26,2

 

please help....tnx, tnx

0 Kudos
Message 1 of 8
(4,454 Views)

Send array to for-loop and use index array to check 1st element in each, Find in 1D-array (in your case 100, 160, 170) and if found add to result-array.

 

The outcome should be a 2d-array with the selected rows.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 8
(4,441 Views)

tnx...can you be more specific..i still have a problem Smiley Frustrated

 

tnx

0 Kudos
Message 3 of 8
(4,428 Views)
Solution
Accepted by topic author ant_inter

I guess you should be more specific about your question. If you are planning to find the values that are present in the 1st column then you can use search 1D array and pass the index to index the 2D array so you will get 1D array of row then build the array by finding the element.

 

Search Array.png

 

Search Array_FP.png

 

This is what Yamaeda explained

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 8
(4,411 Views)

2D_array_Search.png 

This might be helpful..

0 Kudos
Message 5 of 8
(4,406 Views)

Instead of transposing your 2D array you could have indexed 0 to the column (as I have done).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 8
(4,396 Views)

Thats True P@Anand..

Thanks

I have changed the code...Smiley Happy

0 Kudos
Message 7 of 8
(4,390 Views)

It works super 🙂

 

Tnx both of you 🙂

0 Kudos
Message 8 of 8
(4,364 Views)