How do i find the location by using max and find function?
8 ビュー (過去 30 日間)
古いコメントを表示
I have a Matrix
K = [Mon Tue Wed Thu Fri Sat Sun]
L = [1 9 6 5 4 7 3 ;
3 5 6 4 1 8 2]
M = [K; L]
Finding the location that contain the maximum value. For example: 9 is the maximum value in this case and the column that contains it is Tue. So, how do we indicate the name of the column contain the maximum value?
Thank you!
0 件のコメント
採用された回答
Image Analyst
2020 年 9 月 15 日
Don't use max() - it only gives the location of the first global max, not all of them (in the case the max occurs in more than one location). Try this
maxValue = max(yourMatrix);
[rows, columns] = find(yourMatrix == maxValue)
Where yourMatrix is L or Ice or whatever you want.
If you want local maxima, use imregionalmax().
その他の回答 (1 件)
madhan ravi
2020 年 9 月 15 日
doc max % second output , does what you need
3 件のコメント
madhan ravi
2020 年 9 月 15 日
“How do i correct this?”
If it were me I would provide a valid example so that the person answering the question won’t have any trouble. Did you paste the K in command window and see what MATLAB has to say?
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
