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