Borrar filtros
Borrar filtros

How to get sum of columns even if the matrix is a row vector?

1 visualización (últimos 30 días)
I'd like to get the sum of columns in a matrix, but when the matrix has only one row, the SUM function gives the sum of all elements in the row. How can I skip that? The ideal solution will return the row vector itself.

Respuesta aceptada

Matt J
Matt J el 4 de Oct. de 2016
Editada: Matt J el 4 de Oct. de 2016
sum(theMatrix,1)

Más respuestas (0)

Categorías

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