Averaging Every Element of some matrices
2 ビュー (過去 30 日間)
古いコメントを表示
I have 40 matrices of 12x1. How can I take the the each element of every matrix and get a averaged matrix which will be 12x1
採用された回答
Stephen23
2020 年 10 月 6 日
The simple answer is to concatenate all of your matrices into one array, and then use mean. Of course all of your matrices should be in one cell array, because that makes them much easier to work with:
C{1} = [..];
C{2} = [..];
..
C{40} = [..];
A = cat(3,C{:});
M = mean(A,3)
その他の回答 (1 件)
KSSV
2020 年 10 月 6 日
Read about mean. You can specify your required dimension to get the mean along.
A = rand(12,1,40) ;
M = mean(A,3) ;
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!