01-21-2013 03:48 AM
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
Solved! Go to Solution.
01-21-2013 04:26 AM
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
01-21-2013 05:07 AM
tnx...can you be more specific..i still have a problem
tnx
01-21-2013 05:28 AM
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.
This is what Yamaeda explained
01-21-2013 05:34 AM - edited 01-21-2013 05:43 AM
This might be helpful..
01-21-2013 05:39 AM
Instead of transposing your 2D array you could have indexed 0 to the column (as I have done).
01-21-2013 05:45 AM
Thats True P@Anand..
Thanks
I have changed the code...
01-21-2013 07:09 AM
It works super 🙂
Tnx both of you 🙂