Is there a function to sum 1:n matrices of same size?

I have,
n=user input
a=sum(matrix 1 to n)=element by element addition for matrices 1 to n to give a matrix of the same size.
I have tried a=sum(matrix{1:n}) with no luck.

 Accepted Answer

Matt J
Matt J on 18 Feb 2013
Edited: Matt J on 18 Feb 2013
Your notation suggests that your matrices are being held in a cell array matrix{i}, i=1...n. If I continue to assume this,
sum(cat(3,matrix{:}),3)

More Answers (0)

Tags

Asked:

on 18 Feb 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!