Borrar filtros
Borrar filtros

How to sum two rows at a time in matrix

2 visualizaciones (últimos 30 días)
Vishal Sharma
Vishal Sharma el 19 de Jun. de 2017
Respondida: Adam el 19 de Jun. de 2017
I have a matrix of size 6 by 3
A = [1 2 3; 3 4 5; 4 5 6; 5 4 3; 3 4 3; 3 2 1]
I want to make sum of two rows at a time, so as to get result
[18; 27; 16]

Respuesta aceptada

Adam
Adam el 19 de Jun. de 2017
sum( reshape( A', 6, 3 ) )

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays 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