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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

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)

96 correct solutions
95 incorrect solutions

Last solution submitted on Feb 19, 2015

1 player likes this solution

1 Comment

Jean-Marie SAINTHILLIER
on 9 Feb 2014

First time I see this notation.

1 Comment