How can I find the maximum value in a matrix?
66 次查看(过去 30 天)
显示 更早的评论
How can I find the maximum value in a matrix and find its column and row number of this value?
0 个评论
采纳的回答
Andrei Bobrov
2013-6-14
A = randi(100,7,6); % your matrix
v = max(A(:)); % value
[ii,jj] = find(A == v); % row and column number
0 个评论
更多回答(1 个)
Image Analyst
2013-6-14
maxValue = max(yourMatrix);
[row column] = find(yourMatrix==maxValue);
Or you can take the second returned argument from max() and use ind2sub().
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!