Cody

# Problem 6. Select every other element of a vector

Solution 1148847

Submitted on 29 Mar 2017 by Guvanch Gurbandurdyyev
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.7238 0.7335 0.7254 0.4132 0.7341

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

y = Columns 1 through 17 0.4065 0.7688 0.7997 0.1477 0.9877 0.9798 0.8619 0.4043 0.0988 0.7553 0.9303 0.2599 0.4353 0.7398 0.0334 0.6176 0.7521 Columns 18 through 34 0.6075 0.2199 0.4996 0.3980 0.4560 0.8768 0.2656 0.9398 0.0973 0.5404 0.0169 0.6782 0.9347 0.7366 0.8284 0.3933 0.9357 Columns 35 through 50 0.0306 0.0021 0.0675 0.0652 0.9454 0.3938 0.8347 0.6517 0.1448 0.3552 0.7145 0.0463 0.9998 0.0638 0.4575 0.3804

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'