Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 2094. Sum of diagonals elements of a matrix

Created by Swapnali Gujar

Given a matrix, return the sum of all the elements across the diagonals.

E.g. A = [1 2 3; 4 5 6; 7 8 9;]

then, sum = 25 as sum of (1, 3, 7, 9,5)

Tags

Problem Group

Solution Statistics

87 correct solutions 80 incorrect solutions
Last solution submitted on Jul 21, 2014

Problem Comments

Solution Comments