Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

In any matrix, how to generated by sum' same along rows

1 vue (au cours des 30 derniers jours)
Brian Kim
Brian Kim le 21 Fév 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
any matrix is "a". ex) a=[4 4 5 5 5 5 5 5 5 5]; sum(a) is equal to '48'
if one matrix exist, how to generate along rows by same' sum '48'?

Réponses (1)

Star Strider
Star Strider le 21 Fév 2017
The column dimension is the second dimension (the row dimension is the first, and the default in a matrix), so to sum the rows of matrix ‘A’, the code is:
A_row_sum = sum(A, 2);

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by