Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Mohammad Haghighat
Mohammad Haghighat le 4 Oct 2016
Modifié(e) : Matt J le 4 Oct 2016
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.

Réponse acceptée

Matt J
Matt J le 4 Oct 2016
Modifié(e) : Matt J le 4 Oct 2016
sum(theMatrix,1)

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by