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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by