MATLAB Answers

How to sum multiple matrice in loop ?

2 views (last 30 days)
Anne-Laure GUINET
Anne-Laure GUINET on 19 Feb 2019
Edited: Matt J on 20 Feb 2019
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

Accepted Answer

Matt J
Matt J on 19 Feb 2019
Edited: Matt J on 19 Feb 2019
Is this what you want?
result = squeeze(sum(T3,3));
If not please clarify what the dimensions of the final result should be.
  2 Comments
Matt J
Matt J on 20 Feb 2019
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?

Sign in to comment.

More Answers (0)

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!