Cody

# Problem 1725. Diagonal & Anti-Diagonal Matrix: Easy

Solution 803722

Submitted on 9 Jan 2016 by Michael Cappello
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = 3; y_correct = [ 8 0 6; 0 10 0; 4 0 2;] assert(isequal(your_fcn_name(x),y_correct))

y_correct = 8 0 6 0 10 0 4 0 2 y = 0 0 0 0 0 0 0 0 0 m = 8 5 2 y = 8 0 0 0 0 0 0 0 0 y = 8 0 0 0 5 0 0 0 0 y = 8 0 0 0 5 0 0 0 2 m = 6 5 4 m = 4 5 6 y = 8 0 0 0 5 0 4 0 2 y = 8 0 0 0 5 0 4 0 2 y = 8 0 6 0 5 0 4 0 2 y = 8 0 6 0 10 0 4 0 2

2   Pass
%% x = 5; y_correct = [ 17 0 0 0 15; 0 5 0 14 0; 0 0 26 0 0; 0 12 0 21 0; 11 0 0 0 9]; assert(isequal(your_fcn_name(x),y_correct))

y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 m = 17 5 13 21 9 y = 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 17 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 0 0 0 0 0 0 0 0 0 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 0 0 21 0 0 0 0 0 0 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 0 0 21 0 0 0 0 0 9 m = 15 14 13 12 11 m = 11 12 13 14 15 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 0 0 21 0 11 0 0 0 9 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 12 0 21 0 11 0 0 0 9 y = 17 0 0 0 0 0 5 0 0 0 0 0 13 0 0 0 12 0 21 0 11 0 0 0 9 y = 17 0 0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