Cody

# Problem 6. Select every other element of a vector

Solution 1594468

Submitted on 28 Jul 2018 by saravan eluru
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.2310 0.2198 0.2795 0.8222 0.5181

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.8315 0.3341 0.3618 0.1543 0.3715 0.1325 0.0051 0.2239 0.1025 0.7953 0.4261 0.7171 0.0274 0.2462 0.7158 0.7326 0.5509 0.7241 Columns 19 through 36 0.8268 0.1445 0.1874 0.4886 0.1548 0.1962 0.1253 0.3350 0.2333 0.8766 0.3407 0.9297 0.1045 0.5230 0.7250 0.2349 0.7335 0.6338 Columns 37 through 50 0.3614 0.7843 0.4029 0.7782 0.6798 0.8027 0.8800 0.6324 0.2104 0.1128 0.0136 0.5167 0.2815 0.5106

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'