如果我有 a=[2 5 7 1 7]
那么 MATLAB 有没有办法返回向量中两个 7 的索引?我的意思是我正在寻找一个返回 max=7
和 idx=[3 5]
的命令。
最佳答案
使用max
,然后find
:
m = max(a):
idx = find(a==m);
关于matlab - 向量的最大值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21418672/