summation of elements in multi dimensional matrix

1 visualización (últimos 30 días)
fatema saba
fatema saba el 2 de En. de 2015
Comentada: fatema saba el 2 de En. de 2015
Hi
any body there
I have a three dimensional matrix called C. dimension of this matrix is (3,3,k).
K is changeable. I want to create matrix D like that:
D=(C(:,:,1)+C(:,:,2)+....C(:,:,K)
K is changeable. and my be more than 30.
Thankyou

Respuesta aceptada

Stephen23
Stephen23 el 2 de En. de 2015
Editada: Stephen23 el 2 de En. de 2015
Use sum with its second optional argument:
D = sum(C,3)

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by