Problem 60759. Sum along each diagonal of a matrix
Write a routine that returns the sums along the diagonals of a given matrix, A, where the first diagonal is the bottom left corner of the matrix and the final diagonal is the top right corner. For example if,
A =
7 9 4 5 7 5 10 10
6 2 10 2 8 6 8 6
3 3 5 3 3 1 5 6
4 2 2 5 2 3 6 3
5 3 10 6 3 9 3 5
3 5 10 3 4 1 5 7
the desired output will be,
y =
3
10
17
18
21
23
38
22
25
21
19
16
10
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Sum along each diagonal of a matrix
10 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!