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.

采纳的回答

Jan
Jan 2016-2-5
Data = zeros(5, 6, 7);
for k = 1:5
Data(k, :, :) = rand(6, 7);
end
Result = sum(Data, 1);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by