필터 지우기
필터 지우기

Sum of a row

조회 수: 56 (최근 30일)
Farah Shahpoor
Farah Shahpoor 2019년 4월 10일
답변: Guillaume 2019년 4월 10일
Hello,
I have a Matrix 3x30 and I want to have the sum of the first row (element 1 to 30)
Can anyone help me? I just find solutions for sum of a vector or a matrix but I want to have each row seperately.
Thx in advance

답변 (1개)

Guillaume
Guillaume 2019년 4월 10일
sum(yourmatrix, 2)
will give you the sum of each row as 3x1 vector.
sum(yourmatrix(1, :))
will give you the sum of just the first row. (or just take the first element of the previous result)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by