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

52.0% Correct | 48.0% Incorrect
Last Solution submitted on Dec 12, 2024

Solution Comments

Show comments

Problem Recent Solvers10

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!