extracting rows with the highest value

조회 수: 3 (최근 30일)
Nathan
Nathan 2022년 9월 11일
답변: Image Analyst 2022년 9월 11일
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

채택된 답변

Torsten
Torsten 2022년 9월 11일
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

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 9월 11일

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by