LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a 1D array contains atleast one of 2 elements

Solved!
Go to solution

I am aware of searching through an array for 1 element. But how could I do it for 2? I used the search 1D array function twice to check if an array consists of atleast one of two elements for 2 sets.

Is there an elegant way of doing it?

 

0 Kudos
Message 1 of 3
(6,123 Views)

i think that is exactly the way.

for each element you want to find you have to invoke the seach-1d-array function.

if you have the condition either one of your two candidates has to be present,

you can early exit after finding one of the two.

 

in the OpenG tools there is a "Search Array_ogtk.vi" that lets you input an array for the elements to search


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 3
(6,114 Views)
Solution
Accepted by topic author GoKu25

 

SearchMultipleElements.png

Try this which will give the first found element if found, else empty which means none of the elements found

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 3 of 3
(6,097 Views)