Cody

Problem 1725. Diagonal & Anti-Diagonal Matrix: Easy

Solution 1818560

Submitted on 17 May 2019
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   Fail
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

Undefined function 'mgic' for input arguments of type 'int8'. Error in your_fcn_name (line 2) y = mgic(int8(x)); Error in Test1 (line 5) assert(isequal(your_fcn_name(x),y_correct))

2   Fail
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))

Undefined function 'mgic' for input arguments of type 'int8'. Error in your_fcn_name (line 2) y = mgic(int8(x)); Error in Test2 (line 7) assert(isequal(your_fcn_name(x),y_correct))

3   Fail
x = 9; y_correct =[47 0 0 0 0 0 0 0 45; 0 68 0 0 0 0 0 44 0; 0 0 8 0 0 0 43 0 0; 0 0 0 20 0 42 0 0 0; 0 0 0 0 82 0 0 0 0; 0 0 0 40 0 62 0 0 0; 0 0 39 0 0 0 74 0 0; 0 38 0 0 0 0 0 14 0; 37 0 0 0 0 0 0 0 35;]; assert(isequal(your_fcn_name(x),y_correct))

Undefined function 'mgic' for input arguments of type 'int8'. Error in your_fcn_name (line 2) y = mgic(int8(x)); Error in Test3 (line 11) assert(isequal(your_fcn_name(x),y_correct))