MATLAB: How can i take average of matrices in a cell

arraycell

Hi, i have a cell array X{16*12} in which each element of cell X is a 3d array. now I want to take the average of all the matrices in the row which will result in another cell array Y{1,12} (each element of Y cell array consist of 3d array). can anyone please help me with this.
thank you

Best Answer

A - your cell array
one variant
[m,n,k] = size(A{1});
[h,l] = size(A);
A1 = reshape(cat(3,A{:}),m,n,k,h,l);
out = squeeze(num2cell(mean(A1,4),1:3))';