LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any function in CVI that can search the value I needed in an arrary?

    Is there any function in CVI that can search the value I needed  in an arrary? For example, A[0]=0x22, A[1]=0x34, A[2]=0x44. I would like to see a function that can find the location my "0x34".
   Thanks!
Jacky
0 Kudos
Message 1 of 2
(2,894 Views)

Hello Jacky,

the function BinSearch should do what you're looking for:

int item = 0x34;

index = BinSearch (A, 3, sizeof (int ), &item, IntCompare);

This piece of code should result in an index = 1.

0 Kudos
Message 2 of 2
(2,889 Views)