compute the means of a 3-dimensional cell array.
이전 댓글 표시
Hi, I have a cell array C of size < 20x1x19 >, each one the 19 elements contains a set of 20 matrices of size (80x90), How can I want to compute the mean of each 20 matrix and store the result in a matrix M so that in the end I will have a Matrix of size 80x90x19 containing the means of the cell array matrices.
for example:
M(:,:,1) will have the mean of elements in C(:,:,1);
M(:,:,2) will have the mean of elements in C(:,:,2)
and so on. Thank you very much.
답변 (1개)
Andrei Bobrov
2012년 10월 10일
편집: Andrei Bobrov
2012년 10월 10일
Here C - cell array of 20x1x19
C{1} - a double array of 80 x 90
sC = size(C);
out0 = mean(cell2mat(reshape(C,1,1,sC(1),[])),3);
out = reshape(out0,[size(C{1}),sC(3)]);
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!