可能重复:
Given a vector a=[1,2, 3.2, 4, 5] and an element x=3 In vector a, how to find the exact entry which is bigger than x?MATLAB - 我怎么找到的第一个索引,其中值大于阈值
比方说,一个[]是一个排序向量。如何找到第一个(最小)索引ix,使得(ix)>阈值?
可能重复:
Given a vector a=[1,2, 3.2, 4, 5] and an element x=3 In vector a, how to find the exact entry which is bigger than x?MATLAB - 我怎么找到的第一个索引,其中值大于阈值
比方说,一个[]是一个排序向量。如何找到第一个(最小)索引ix,使得(ix)>阈值?
ix = find(a>threshold,1);
很肯定这会工作
ix = find(a > threshold, 1, 'first');
不,你别。从Matlab的文档中可以看出:I = FIND(X,K,'first')和I = FIND(X,K)是一样的。'如果你想反过来,你只需要指出'last'。 – Phonon
phonon和oli都可以使用。 – BlessedKey
噢。当然。我没有看到',1'。对不起:) :) – abcd