フィルターのクリア

How do you find the average of specific columns for all rows?

25 ビュー (過去 30 日間)
Anonymous Matrix
Anonymous Matrix 2017 年 2 月 21 日
コメント済み: Anonymous Matrix 2017 年 2 月 21 日
say like I have this 2D matrix
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
how do I find the average/mean for all of the rows but only for columns 1,2, and 6?

採用された回答

Jos (10584)
Jos (10584) 2017 年 2 月 21 日
Select the columns, and then perform the operation:
A = magic(6)
B = A(:,[1 2 6])
meanVal = mean(B,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