Cody

# Problem 42982. Select every other element of a matrix

Solution 1627319

Submitted on 14 Sep 2018 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
assert(isequal(odd_idx([1, 2, 3;4, 5, 6;7, 8, 9]),[1, 3;7, 9]))

x = 1 2 3 7 8 9 x = 1 3 7 9

2   Pass
assert(isequal(odd_idx([16 2 3 13;5 11 10 8;9 7 6 12;4 14 15 1]),[16, 3;9, 6]))

x = 16 2 3 13 9 7 6 12 x = 16 3 9 6

3   Pass
assert(isequal(odd_idx(1), 1))

x = 1 x = 1

4   Pass
assert(isequal(odd_idx([1 2]), 1))

x = 1 2 x = 1

5   Pass
assert(isequal(odd_idx([1; 2]), 1))

x = 1 x = 1

6   Pass
assert(isequal(odd_idx([7 3 4 7 2 9 4 9 5 8]), [7 4 2 4 5]))

x = 7 3 4 7 2 9 4 9 5 8 x = 7 4 2 4 5

7   Pass
assert(isequal(odd_idx([5;2;8;6;6;10;4;9;6;7]),[5;8;6;4;6]))

x = 5 8 6 4 6 x = 5 8 6 4 6

8   Pass
assert(isequal(odd_idx([2 4 4 2 2 1;4 2 2 5 2 4;4 2 2 1 2 1;2 3 5 5 1 1;3 4 2 5 5 1;3 5 3 1 4 1;5 2 2 5 5 2]), [2 4 2; 4 2 2; 3 2 5; 5 2 5]))

x = 2 4 4 2 2 1 4 2 2 1 2 1 3 4 2 5 5 1 5 2 2 5 5 2 x = 2 4 2 4 2 2 3 2 5 5 2 5