How to sum multiple matrice in loop ?

5 ビュー (過去 30 日間)
Anne-Laure GUINET
Anne-Laure GUINET 2019 年 2 月 19 日
編集済み: Matt J 2019 年 2 月 20 日
Hi everybody,
I would like to sum multiple matrice using a loop.
I attach my data.
So, I have a multiple 4D double structure, that contains 4x4x32x12 matrices.
I would like to sum all the matrices according the last argument to obtain 12 matrices which are the sum of the 32 matrices (in my code i = 1:12 ; j = 1:32).
I think I have to use a loop.
Is anybody could help me?
Thanks,
-- AL

採用された回答

Matt J
Matt J 2019 年 2 月 19 日
編集済み: Matt J 2019 年 2 月 19 日
Is this what you want?
result = squeeze(sum(T3,3));
If not please clarify what the dimensions of the final result should be.
  2 件のコメント
Anne-Laure GUINET
Anne-Laure GUINET 2019 年 2 月 20 日
The dimension of the final matrice is correct 4x4x12 but it doens't correspond to the addition of all matrices.
I try to explain in other words. I would like to realize an addition of the first 32, and next 32 etc... and stock this result in a new 4x4x12 matrice.
Matt J
Matt J 2019 年 2 月 20 日
編集済み: Matt J 2019 年 2 月 20 日
That is what I believe I gave you...
If we index the array as T(i,j,m,n) are we summing across m or something else?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by