MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   给定向量a = [1,2,3.2,4,5]和元素x = 3在向量a中,如何找到大于x的确切项? (https://www.labfans.com/bbs/showthread.php?t=23828)

poster 2019-12-10 20:48

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



[B]回答:[/B]

我不确定您所说的“精确”输入是什么意思。这将为您提供[I]所有[/I]大于x的值的索引:

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

index = find(a > x,1);

[url=https://stackoverflow.com/questions/3593717]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 14:17

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.