Obtain SUM for a 3D matrix

Hi,
I have a precip matrix 360 x 280 x 365 and I want to obtain the sum for all the values in (:,:,365). For example,
output = sum(precip(360x280x1)+precip(360x280x2)+precip(360x280x3)..+precip(360x280x365)
So, the output matrix should be, output = 360 x 280. Can anyone suggest me a methos in MATLAB?
Thanks in advance.

 Respuesta aceptada

Matt J
Matt J el 14 de Jul. de 2015
Editada: Matt J el 14 de Jul. de 2015

2 votos

output = sum(precip,3);

3 comentarios

Damith
Damith el 15 de Jul. de 2015
Thanks.
hussain Palagiri
hussain Palagiri el 14 de Nov. de 2021
How to get sum for only 90 pages out of 365 pages?
Matt J
Matt J el 14 de Nov. de 2021
output = sum(precip(:,:,1:90),3);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 14 de Jul. de 2015

Comentada:

el 14 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by