Finding largest values in matrix

1 次查看(过去 30 天)
I would like to find the 10 largest values in a 90x90 matrix, and their indices. Any suggestions? Thanks, Yaniv

采纳的回答

Ced
Ced 2016-4-10
编辑:Ced 2016-4-10
A = randn(90);
Nmax = 10; % get Nmax biggest entries
[ Avec, Ind ] = sort(A(:),1,'descend');
max_values = Avec(1:Nmax);
[ ind_row, ind_col ] = ind2sub(size(A),Ind(1:Nmax)); % fetch indices
You can of course also use a while loop and pick out one value at a time.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by