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

63 Solutions

22 Solvers

Last Solution submitted on Feb 26, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers22

Suggested Problems

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!