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.

 Réponse acceptée

Matt J
Matt J le 18 Fév 2013
Modifié(e) : Matt J le 18 Fév 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)

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by