extracting rows with the highest value

4 visualizzazioni (ultimi 30 giorni)
Nathan
Nathan il 11 Set 2022
Risposto: Image Analyst il 11 Set 2022
I want to extract a row that has the highest value in one of the columns for example:
1 3
4 6
2 5
8 1
I would want to extract the row of 8 1

Risposta accettata

Torsten
Torsten il 11 Set 2022
A = [1 3
4 6
2 5
8 1];
[~,imax] = max(A(:));
[irow,~] = ind2sub(size(A),imax(1))
irow = 4
A(irow,:)
ans = 1×2
8 1

Più risposte (1)

Image Analyst
Image Analyst il 11 Set 2022

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by