Averaging the data from a 3d matrix and populating it in a 2D matrix.

1 回表示 (過去 30 日間)
Arup Bhattacharya
Arup Bhattacharya 2019 年 10 月 17 日
コメント済み: Arup Bhattacharya 2019 年 10 月 17 日
I have a problem. I have a 3D matrix, lets say A(15,8,40) and I want to get a new matrix, lets say B(15,8) where every row in matrix B will have the mean value of that row, averaged over the third dimension, in this case 40. How can I do that?
  1 件のコメント
Arup Bhattacharya
Arup Bhattacharya 2019 年 10 月 17 日
I also want to calculate the stanard errors.

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

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 10 月 17 日
B = mean(A,3);
  1 件のコメント
Arup Bhattacharya
Arup Bhattacharya 2019 年 10 月 17 日
Thank you for the answer.
I have a Matrix named June21_Once_StillMat - the size of which is 15 x 41 x 40. I am trying to get the data from the colums 2 to 8 of the matrix une21_Once_StillMat to a new matrix A of size 15 x 8 x 40.
for j=1:15;
for k=1:8;
for i=1:40;
A(j,k,i)=June21_Once_StillMat(j,k+1,i);
end
end
end
I need to average the values of each row over i (40) from matrix A and populate that data to a new 3D matrix B of size 8 x 8 x 15. The third column of matrix B, B(k,3,j) will have the value obtained from the averaged value and the 4th column of matrix B, B(k,4,j) will be the standard error. I am not being able to figure this out.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by