Hi, I want to know how to sum all the matrices in a loop at the end of it
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Saad Syed Iqbal Ahmed
le 5 Fév 2016
Modifié(e) : Stephen23
le 5 Fév 2016
I have a loop in which I define a matrix in each iteration. At the end of it I want to sum all of these matrices. Any help would be appreciated.
2 commentaires
Réponse acceptée
Jan
le 5 Fév 2016
Data = zeros(5, 6, 7);
for k = 1:5
Data(k, :, :) = rand(6, 7);
end
Result = sum(Data, 1);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!