Cody

# Problem 6. Select every other element of a vector

Solution 917170

Submitted on 30 Jun 2016 by Matt Tu
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.4896 0.6253 0.8324 0.8470 0.8445

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

y = Columns 1 through 9 0.5244 0.7251 0.2968 0.7377 0.4986 0.1839 0.8374 0.0426 0.5482 Columns 10 through 18 0.7600 0.8716 0.8314 0.8107 0.3386 0.8846 0.0656 0.2361 0.2551 Columns 19 through 27 0.1747 0.7702 0.5634 0.1994 0.5195 0.1072 0.4050 0.4725 0.6240 Columns 28 through 36 0.2026 0.6176 0.9560 0.5273 0.6864 0.1577 0.8179 0.4583 0.7713 Columns 37 through 45 0.0447 0.0051 0.6075 0.6337 0.9498 0.1762 0.2395 0.6382 0.5076 Columns 46 through 50 0.8313 0.3719 0.9460 0.0444 0.9738

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