Problem 1158. Sum the elements in either diagonal of a square matrix
Sum the elements of a square matrix that lie on either the major diagonal or anti-diagonal. (Include all elements that are part of either of the diagonals).
Solution Stats
Problem Comments
-
3 Comments
Gareth Lee
on 1 May 2015
the description of your problem is wrong, not the same as test suits. the either..or... should be both...and...
Tom Holz
on 31 May 2017
I updated the description to clarify the ambiguity mentioned by Gareth Lee on 1 May 2015.
Tom Holz
on 31 May 2017
With apologies for the 2 year delay, I've updated the description to be a little more explicit.
Solution Comments
Show commentsProblem Recent Solvers216
Suggested Problems
-
Return the 3n+1 sequence for n
8451 Solvers
-
2695 Solvers
-
Back to basics 20 - singleton dimensions
273 Solvers
-
389 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
869 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!