Hi, I want to know how to sum all the matrices in a loop at the end of it
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Jan
2016-2-5
Data = zeros(5, 6, 7);
for k = 1:5
Data(k, :, :) = rand(6, 7);
end
Result = sum(Data, 1);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!