09-01-2014 02:31 AM
Hi would like to search all rows in a 2D array to find whether the particular row I'm searching for is in the 2-D array and return the row index of the 1-D array. How do I do it?
For example from a CSV file consisting of Name and contact of several people, I want to search if the name and contact keyed in by me is there in the list.
Thanks
09-01-2014 02:41 AM
Hi shreya,
autoindexing FOR loop might be a great help here: index your rows of the 2D array to compare them with your "keyed in" data…
Beware of typos and other problems when comparing strings!
Other solution:
Convert your data into an 1D array of (typedef) cluster! Now you could use Search1DArray again…
09-01-2014 02:41 AM
The algorithm I have in mind is similar to searching a single element in a 1D array. So, after you wire the 2D array to the for-loop and splitt it into 1D arrays, you can compare two 1D arrays (all elements at once).
Cheers,
09-01-2014 07:38 AM
Autoindexing FOR loop is definately the easiest way to go here. Be sure to have the Conditional Terminal visible so that you can stop your loop once you have a match.