how to sum each element in matrix

so I have this matrix and i want to sum of the each element of matrix like in this picture.how can i do that.

댓글 수: 3

madhan ravi
madhan ravi 2018년 8월 20일
You just want to sum the first two and last two numbers of each row?
Image Analyst
Image Analyst 2018년 8월 20일
No, I can't see. What arrows? What numbers are the sum of what other two numbers? And where is the square?
mts
mts 2018년 8월 21일
I mean red line , yellow line and black line are sum of two numbers also black rectangle is sum of three numbers and red rectangle is sum of four numbers

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2018년 8월 21일

0 개 추천

You say "I mean red line , yellow line and black line are sum of two numbers also black rectangle is sum of three numbers and red rectangle is sum of four numbers" so
redLineSumOf2 = A(1,1) + A(1,4)
yellowLineSumOf2 = A(1,1) + A(1,3)
blackLineSumOf2 = A(1,1) + A(1,2)
blackRectSumOf3 = sum(A(1, 1:3))
redRectSumOf4 = sum(A(1, 1:4))

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

mts
2018년 8월 20일

답변:

2018년 8월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by