poster
2019-12-10, 20:48
给定向量a = [1,2,3.2,4,5]和元素x = 3在向量a中,如何找到大于x的确切项?
回答:
我不确定您所说的“精确”输入是什么意思。这将为您提供所有大于x的值的索引:
indices = find(a > x); 假设a已经排序,这将为您提供第一个索引(即,大于x的最小值):
index = find(a > x,1);
更多&回答... (https://stackoverflow.com/questions/3593717)
回答:
我不确定您所说的“精确”输入是什么意思。这将为您提供所有大于x的值的索引:
indices = find(a > x); 假设a已经排序,这将为您提供第一个索引(即,大于x的最小值):
index = find(a > x,1);
更多&回答... (https://stackoverflow.com/questions/3593717)