breakpoints

Hi,
I have a long matrix of breakpoints: for example, 0.19 0.49 0.69 0.93 1.69
is there an easy function to determine if I have a value of 0.55 for example that this value would fall under the third category since it is between 0.49 and 0.69?

 采纳的回答

Andrew Newell
Andrew Newell 2011-6-11
Assuming your breakpoints are sorted (I'll call them breakpoints), you could do something like this:
x = 0.55;
find(breakpoints<x,1,'last')

更多回答(1 个)

Walter Roberson
Walter Roberson 2011-6-11
[v, idx] = histc(x, [-inf breakpoints]);
then the value you want is idx

类别

在 帮助中心 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by