3D matrix summation

24 visualizaciones (últimos 30 días)
Adi Nor
Adi Nor el 9 de Mayo de 2017
Comentada: Orlando Ramirez-Valle el 14 de Feb. de 2021
If I have the following 3D matrices. How I sum every T(:,:,1) with its following T(:,:,2) to have 3 2D matrices.
T(:,:,1) =
0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0 0 0
21 0 0 0 0 0 0 0 0 0
0 22 0 0 0 0 0 0 0 0
0 0 23 0 0 0 0 0 0 0
0 0 0 24 0 0 0 0 0 0
0 0 0 0 25 0 0 0 0 0
0 0 0 0 0 26 0 0 0 0
0 0 0 0 0 0 27 0 0 0
T(:,:,2) =
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 13 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 14 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
T(:,:,1) =
0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0 0 0
21 0 0 0 0 0 0 0 0 0
0 22 0 0 0 0 0 0 0 0
0 0 23 0 0 0 0 0 0 0
0 0 0 24 0 0 0 0 0 0
0 0 0 0 25 0 0 0 0 0
0 0 0 0 0 26 0 0 0 0
0 0 0 0 0 0 27 0 0 0
T(:,:,2) =
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 4 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 14 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
T(:,:,1) =
0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0 0 0
21 0 0 0 0 0 0 0 0 0
0 22 0 0 0 0 0 0 0 0
0 0 23 0 0 0 0 0 0 0
0 0 0 24 0 0 0 0 0 0
0 0 0 0 25 0 0 0 0 0
0 0 0 0 0 26 0 0 0 0
0 0 0 0 0 0 27 0 0 0
T(:,:,2) =
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 4 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 5 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
How I sum every T(:,:,1) with its following T(:,:,2) to have 3 2D matrices.
  3 comentarios
Adi Nor
Adi Nor el 9 de Mayo de 2017
I have several of these arrays
Jan
Jan el 10 de Mayo de 2017
@Mahmoud: Please answer James' question: What is wrong with T(:,:,1) + T(:,:,2)?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 9 de Mayo de 2017
For any one of them,
sum(T, 3)
  1 comentario
Orlando Ramirez-Valle
Orlando Ramirez-Valle el 14 de Feb. de 2021
Hello,
How can I add in 3D using intervals;
example:
(62x50x341) 3d matrix
I want to add the following intervals in 3D:
Intervals; 8,30,31,31,30,31,30,31,31,28,31,29
is it possible to do it in a loop?
Thanks in advance

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by