Cody

# Problem 6. Select every other element of a vector

Solution 1076536

Submitted on 7 Dec 2016 by Eric Saunders
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.2116 0.8348 0.9360 0.5650 0.4774

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.1713 0.8631 0.0214 0.0276 0.4993 0.3394 0.3787 0.9315 0.0313 Columns 10 through 18 0.1872 0.7488 0.8155 0.8672 0.0685 0.1255 0.2789 0.1006 0.9224 Columns 19 through 27 0.3811 0.9974 0.9031 0.0595 0.6254 0.9390 0.9214 0.9959 0.2583 Columns 28 through 36 0.8714 0.3130 0.6598 0.0352 0.4283 0.9840 0.6738 0.7374 0.3061 Columns 37 through 45 0.2386 0.4709 0.4747 0.5094 0.8699 0.0208 0.7178 0.3448 0.2856 Columns 46 through 50 0.0756 0.9039 0.0278 0.3793 0.2357

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