How can I find out the indices of the largest 10 values within the matrix?

68 ビュー (過去 30 日間)
Ashfaq Ahmed
Ashfaq Ahmed 2022 年 4 月 27 日
回答済み: Matt J 2022 年 4 月 27 日
Hey guys, I am facing a problem and I am sensing the solution should be relatively easy.
Suppose I have a 100x100 matrix with random values -
A = rand(100,100);
and I have stored the LARGEST 10 values from the matrix in this variable -
stored = maxk(A(:),10);
My question is - how can I find out the indices of these top 10 values from matrix A?
Any feedback will be highly appreciated!

回答 (1 件)

Matt J
Matt J 2022 年 4 月 27 日
[stored,indices] = maxk(A(:),10);

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by