Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

2 ビュー (過去 30 日間)
Brian Kim
Brian Kim 2017 年 2 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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'?

回答 (1 件)

Star Strider
Star Strider 2017 年 2 月 21 日
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);

Community Treasure Hunt

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

Start Hunting!

Translated by