You need to start with an array. Then you sort the array in either ascending or descending order, otherwise the principle of the binary search won`t work.
Once you have the sorted array, you can either use the LAbVIEW search array VI or you can implement your own binary search.
Array with elements 0..n, with a target of X.
The Array is passed to a while loop through a non-indexing tunnel as working on a single array without modifications is quickest.
In a while loop you take the middle value (max-min)/2. If this value is greater than your target (assuming the array is sorted in ascending order) then min is set to the current index. If the value is smaller, Max is set to the current index.
Repeat loop until either the item at the current index matches y
our target, or max-min < 2.
If the exact match is not found, your routine must make a choice whether to return the next (higher or lower) item, or return an error with an invalid value.
Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)