给定一个向量a = [1,2,3.2,4,5]和一个元素x = 3在向量a中,如何找到大于x的确切条目?

use*_*609 7 matlab

给定一个向量a = [1,2,3.2,4,5]和一个元素x = 3在向量a中,如何找到大于x的确切条目?

gno*_*ice 11

我不确定你的"确切"条目是什么意思.这将为您提供大于的所有值的索引x:

indices = find(a > x);
Run Code Online (Sandbox Code Playgroud)

假设a已经排序,这将为您提供第一个索引(即最大值大于x):

index = find(a > x,1);
Run Code Online (Sandbox Code Playgroud)