Extract maximum value out of two column in a row & delete the last row

조회 수: 4 (최근 30일)
Poulomi Ganguli
Poulomi Ganguli 2019년 7월 26일
답변: dpb 2019년 7월 26일
Hello:
I have two matrix A and B as below. I need to extract maximum value out of column 6th and 7th and delete the last column.
1 6337100 52.17 8.86 0.10 0.22 0.33
1 6337200 52.96 9.12 0.08 0.19 0.36
1 6338100 52.74 7.24 0.15 0.27 0.30
1 6338110 52.59 7.24 0.19 0.30 0.39
1 6338130 52.28 7.43 0.21 0.32 0.38
1 6340110 53.23 10.8 0.03 0.09 0.29
1 6340210 53.65 10.0 0.30 0.35 0.19
1 6340216 53.57 10.0 0.28 0.35 0.26
Output matrix
1 6337100 52.17 8.86 0.1 0.33
1 6337200 52.96 9.12 0.08 0.36
1 6338100 52.74 7.24 0.15 0.3
1 6338110 52.59 7.24 0.19 0.39
1 6338130 52.28 7.43 0.21 0.38
1 6340110 53.23 10.8 0.03 0.29
1 6340210 53.65 10 0.3 0.35
1 6340216 53.57 10 0.28 0.35

채택된 답변

dpb
dpb 2019년 7월 26일
B=[A(:,1:end-2) max(A(:,end-1:end),[],2)]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by