MATLAB: How to sum same size cell blocks

blockcellreshapesum

Hi all,
I have a cell which contains same size matrices, like this:
inpt =
[13x13 double] [13x13 double] [13x13 double] [13x13 double]
Is there a function to sum blocks within a cell? So the result would be a [13*13] matrix with elements of same entry summations of inpt.
Many thanks!

Best Answer

sum(cat(3, inpt{:}), 3)
is one way to do it. Basically, concatenate your matrices along an extra dimension and sum along that dimension.
Related Question