Binary Search

Binary search of values in a data vector.

您现在正在关注此提交

bsearch(x,var)

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. If the values in 'var' are outside the range of 'x' then either 1 or length(x) are returned as indices for those values.

引用格式

Aroh Barjatya (2026). Binary Search (https://ww2.mathworks.cn/matlabcentral/fileexchange/7552-binary-search), MATLAB Central File Exchange. 检索时间: .

致谢

启发作品: Binary Search for numeric vector

类别

Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.0.0.0

update for out of bound values