LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching 1D array for data present in lookup 1D array.

Hi!,
I have a sorted 1D array of strings(say initial array) and I have
three lookup array of string(say array A, array B and array C). I want
to search the initial array with array A, array B and array C and then
create a new array Final which will contain the elements of array A,
if any, its start index and its last index and then element sof
arrayB, if any found, its start index and its end index and then
element of array C its start index and its end index.
The start index and end index are stored in different indicatrs for
all the three found.
How do I search elements of 1D array with another 1D array?
TIA,
RK
0 Kudos
Message 1 of 2
(2,646 Views)
There are probably several ways to do it. One way to do it you would create a For Loop with the initial array run into it with auto-indexing turned off. You would then run array A into it with auto-indexing turned on. Inside of the loop, you would use a Search Array to find the index (if any) of the element in the initial array that matched the auto-indexed element of Array A. You will want to either build an array of only the indexes >=0 (trapping the "not found" -1) or you can autoindex the results and have you later code deal with them.

You will need three of these loops, one for each searching array. Or better, you could push it into a subVI and call it three times.

I hope that this helps!
Bob Young
0 Kudos
Message 2 of 2
(2,646 Views)