Cody

# Problem 6. Select every other element of a vector

Solution 2178776

Submitted on 27 Mar 2020 by yusuf sali
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 = rand(1,10); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

b = 1 b = 2 b = 3 b = 4 b = 5 b = 6

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

b = 1 b = 2 b = 3 b = 4 b = 5 b = 6 b = 7 b = 8 b = 9 b = 10 b = 11 b = 12 b = 13 b = 14 b = 15 b = 16 b = 17 b = 18 b = 19 b = 20 b = 21 b = 22 b = 23 b = 24 b = 25 b = 26 b = 27 b = 28 b = 29 b = 30 b = 31 b = 32 b = 33 b = 34 b = 35 b = 36 b = 37 b = 38 b = 39 b = 40 b = 41 b = 42 b = 43 b = 44 b = 45 b = 46 b = 47 b = 48 b = 49 b = 50 b = 51

3   Pass
x = ['A' 'long' 'time' 'ago' 'in' 'a' 'galaxy' 'far' 'far' 'away']; actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

b = 1 b = 2 b = 3 b = 4 b = 5 b = 6 b = 7 b = 8 b = 9 b = 10 b = 11 b = 12 b = 13 b = 14 b = 15 b = 16 b = 17