标签: matlab find
可能重复: 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?
假设[]是一个有序向量。如何找到第一个(最小的)索引ix,使得a(ix)>阈值ε
答案 0 :(得分:34)
ix = find(a>threshold,1);
很确定这会起作用
答案 1 :(得分:13)
ix = find(a > threshold, 1, 'first');
答案 2 :(得分:5)
哎呀, 当且仅当a被排序时,你可以这样做:
ix = sum(a<=threshold)+1;