Cody

# Problem 6. Select every other element of a vector

Solution 1974356

Submitted on 13 Oct 2019 by xin wang
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))

y = 0.2938 0.9448 0.0567 0.8440 0.7069

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

y = Columns 1 through 18 0.2596 0.4147 0.5508 0.4424 0.7907 0.6758 0.9338 0.5394 0.3636 0.1189 0.7544 0.7934 0.6490 0.8700 0.5608 0.0579 0.3946 0.0903 Columns 19 through 36 0.6467 0.9618 0.6506 0.5751 0.9806 0.7883 0.7163 0.1461 0.8155 0.4978 0.5614 0.5555 0.4773 0.2000 0.1858 0.0799 0.8423 0.2754 Columns 37 through 50 0.6571 0.7205 0.5713 0.7703 0.4284 0.4174 0.3117 0.2950 0.8315 0.0830 0.6880 0.8468 0.7678 0.5714

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

y = 'Aogiegiaaayafrwy'