Cody

# Problem 44739. Return all matrix elements except elements on diagonal

Solution 1992492

Submitted on 27 Oct 2019 by Nikolaos Nikolaou
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 = randi(10,5,5); y=elmex(x) assert(isequal(y(1),x(6)))

x = 6 9 6 8 1 4 6 7 6 6 6 10 9 5 2 9 8 2 4 9 8 3 1 6 10 y = 6 4 6 9 8 9 6 10 8 3 6 7 9 2 1 8 6 5 4 6 1 6 2 9 10 y = 4 6 9 8 9 10 8 3 6 7 2 1 8 6 5 6 1 6 2 9 y = 4 6 9 8 9 10 8 3 6 7 2 1 8 6 5 6 1 6 2 9 y = 4 6 9 8 9 10 8 3 6 7 2 1 8 6 5 6 1 6 2 9

2   Pass
x = [0 1 2 3;12 15 5 62;3 0 0 9;17 89 6 1]; y_correct = [1 2 3 12 5 62 3 0 9 17 89 6]; assert(isequal(elmex(x),y_correct))

x = 0 12 3 17 1 15 0 89 2 5 0 6 3 62 9 1 y = 0 1 2 3 12 15 5 62 3 0 0 9 17 89 6 1 y = 1 2 3 12 5 62 3 0 9 17 89 6 y = 1 2 3 12 5 62 3 0 9 17 89 6

3   Pass
x = ones(6,6); y_correct = ones(1,30); assert(isequal(elmex(x),y_correct))

x = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = Columns 1 through 29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Column 30 1