IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
bsearch.m File Reference

Detailed Description

Binary Search.

Written by Aroh Barjatya

Binary search for values specified in vector 'var' within data vector 'x' The data has to be pre-sorted in ascending or decending order There is no way to predict how the function will behave if there are multiple numbers with same value. returns the index values of the searched numbers

flag_bin added by JT. flag_bin = 1 will cause to return the index corresponding to the highest number in case of var being between two numbers.

Definition in file bsearch.m.

Go to the source code of this file.

Functions

function bsearch (in x, in var, in flag_bin)
 

Function Documentation

function bsearch ( in  x,
in  var,
in  flag_bin 
)
Parameters
x
var
flag_bin
Returns
index