Location of maximum number in matrix??
43 ビュー (過去 30 日間)
表示 古いコメント
%Suppose I have a matrix
A=[2 3 4;
5 6 7;
8 9 0];
%I want to Find the location of maximum number in the matrix ie of 9.
%How to find it??
c=max(A); % what to do next ?
0 件のコメント
採用された回答
その他の回答 (1 件)
Julia
2015 年 4 月 20 日
Hi,
you have to take the "double maximum", since your c gives a vector. Then you can use the find() function.
>> c=max(max(A))
>> B=find(A==c)
B is just a number. To see how Matlab uses linear indexing click the following link:
0 件のコメント
参考
カテゴリ
Find more on Matrix Indexing in Help Center and File Exchange
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!