LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1D Array Search

I am attempting to search a 1D array for a certain value... the problem is that the value appears more than once in the array and i need it to find all those values... unfortunately the 1D array search template stops after finding the first item... anyone know a solution to this?
0 Kudos
Message 1 of 4
(2,932 Views)
You might want to put your 1d search arry vi into a loop structure with shift reagisters. Use the index of the first found item, add "1" to it and loop it back into the vi as the new "start" address via the shift register.
Message 2 of 4
(2,932 Views)
Very simple way to do this:

1) Use a loop to iterate through every element in the array.
2) Compare the value of each element to what you are searching for.
3) If they are equal, store the value of the loop counter to an array.

Yes, you can use a while loop and the search array vi, but this is just as easy and much more intuitive. See the attached for details. Cheers.

- Jim Cavera
0 Kudos
Message 3 of 4
(2,932 Views)
I'd guess that the previous method using Search 1D Array would be faster, if your array is large...
0 Kudos
Message 4 of 4
(2,932 Views)