How can I extract all values in a row of an array without the its maximum value

조회 수: 4 (최근 30일)
ex a=
1 3 6 5
6 7 1 9
5 3 9 10
the extracted row will be 5 3 9

채택된 답변

Stephen23
Stephen23 2017년 11월 19일
편집: Stephen23 2017년 11월 19일
>> a = [1,3,6,5;6,7,1,9;5,3,9,10]
a =
1 3 6 5
6 7 1 9
5 3 9 10
>> [r,c] = find(a==max(a(:))); % identify row and column of max value.
>> b = a(r,[1:c-1,c+1:end]) % extract row, excluding max value.
b =
5 3 9

추가 답변 (1개)

KL
KL 2017년 11월 19일
A = [5 3 9 10];
res = A(A~=max(A))

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by