Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
Brian Kim
Brian Kim am 21 Feb. 2017
Geschlossen: MATLAB Answer Bot am 20 Aug. 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'?

Antworten (1)

Star Strider
Star Strider am 21 Feb. 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);

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by