data analysis
1 次查看(过去 30 天)
显示 更早的评论
if i have array x and i want to get the index of maximum value of it ex:x=[1 2 3 4 5 0 11] i want command which give me that index of max(x)->7
0 个评论
采纳的回答
Geoff
2012-3-19
Use the find function:
indices = find(x == max(x));
There might be more than one maximum, so your output might be a vector. If you want just one value, use this:
index = find(x == max(x), 1);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!