Hi, I want to know how to sum all the matrices in a loop at the end of it

3 ビュー (過去 30 日間)
Saad Syed Iqbal  Ahmed
Saad Syed Iqbal Ahmed 2016 年 2 月 5 日
編集済み: Stephen23 2016 年 2 月 5 日
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 件のコメント
Walter Roberson
Walter Roberson 2016 年 2 月 5 日
How are you storing the individual matrices?
Stephen23
Stephen23 2016 年 2 月 5 日
編集済み: Stephen23 2016 年 2 月 5 日
Easy: save the data matrices together in one array, then you just need sum at the end.

サインインしてコメントする。

採用された回答

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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by