How to find maximum element of particular column in a array

4 ビュー (過去 30 日間)
Ashutosh
Ashutosh 2022 年 9 月 7 日
コメント済み: Ashutosh 2022 年 9 月 7 日
A=[1,2,3,4,5,18;7,8,9,16,11,12;13,14,15,10,17,6]
A = 3×6
1 2 3 4 5 18 7 8 9 16 11 12 13 14 15 10 17 6
Now I need maximum value of column 2,4 and 6
which is 14,16 and 18

採用された回答

Walter Roberson
Walter Roberson 2022 年 9 月 7 日
max(A(:, [2 4 6]),[],1)
The ,1 forces it to take maximum along columns even if there is only one row

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by