how to sum each element in matrix
Mostrar comentarios más antiguos
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 comentarios
madhan ravi
el 20 de Ag. de 2018
You just want to sum the first two and last two numbers of each row?
Image Analyst
el 20 de Ag. de 2018
No, I can't see. What arrows? What numbers are the sum of what other two numbers? And where is the square?
mts
el 21 de Ag. de 2018
Respuestas (1)
Image Analyst
el 21 de Ag. de 2018
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))

Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!