Given a square matrix, return the sum of its main diagonal elements. Example: diag_sum([1 2 3; 4 5 6; 7 8 9]) returns 15
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
-
Sum the main diagonal of a matrix
6 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!