Mean of 3rd dimension

1 回表示 (過去 30 日間)
Cside
Cside 2020 年 1 月 16 日
コメント済み: Cside 2020 年 1 月 16 日
I have a matrix of 10 x 20 x 35. How do I mean the first 5 layers of the 3rd dimension (layers 1-5), resulting in 2D matrix of 10x20?
Thanks!

採用された回答

Hiro Yoshino
Hiro Yoshino 2020 年 1 月 16 日
A = [1 2 3; 4 5 6; 7 8 9];
A(:,:,2) = [10 11 12; 13 14 15; 16 17 18];
A(:,:,3) = [19 20 21; 22 23 24; 25 26 27];
A(:,:,3) = [28 29 30; 31 32 33; 34 35 36];
meanA = mean(A(:,:,1:2),3);
Take a look at this exampl. This will help you out!
also you should see the function "mean":
  1 件のコメント
Cside
Cside 2020 年 1 月 16 日
thank you hiro :)

サインインしてコメントする。

その他の回答 (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