How to calculate the weighted average over a cell-array of arrays?
问题 In generalisation of my previous question, how can a weighted average over cell elements (that are and shall remain arrays themselves) be performed? I'd start by modifying gnovice's answer like this: dim = ndims(c{1}); %# Get the number of dimensions for your arrays M = cat(dim+1,c{:}); %# Convert to a (dim+1)-dimensional matrix meanArray = sum(M.*weigth,dim+1)./sum(weigth,dim+1); %# Get the weighted mean across arrays And before that make sure weight has the correct shape. The three cases