Cody

# Problem 6. Select every other element of a vector

Solution 1723691

Submitted on 9 Feb 2019 by Diogo Carvalho
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.9484 0.7417 0.6399 0.8830 0.6693

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.3513 0.0039 0.6358 0.9123 0.8624 0.0057 0.9630 0.0623 0.5068 0.7182 0.5830 0.7577 0.4474 0.9908 0.0133 0.4097 0.8937 0.7781 Columns 19 through 36 0.0173 0.5643 0.0448 0.5465 0.9138 0.1831 0.4829 0.3800 0.9577 0.2042 0.1317 0.8743 0.2327 0.3480 0.7384 0.0012 0.0318 0.6875 Columns 37 through 50 0.4520 0.3539 0.7526 0.8554 0.1295 0.7160 0.1444 0.1748 0.4620 0.5795 0.2536 0.3213 0.8406 0.9180

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'