Cody

# Problem 6. Select every other element of a vector

Solution 1437860

Submitted on 10 Feb 2018 by Georg Balke
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.2408 0.4956 0.7999 0.8772 0.6166

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.5455 0.1282 0.8467 0.2073 0.1368 0.3099 0.4281 0.9098 0.3850 0.3432 0.7871 0.8489 0.5652 0.4940 0.6203 0.1620 0.9915 Columns 18 through 34 0.5116 0.3565 0.6366 0.0414 0.5655 0.2162 0.3973 0.0058 0.6916 0.1436 0.2150 0.7501 0.2040 0.1651 0.5985 0.6424 0.2759 Columns 35 through 50 0.2651 0.3347 0.4716 0.9025 0.8315 0.2752 0.5985 0.6735 0.9535 0.8336 0.4012 0.5418 0.9769 0.0292 0.6849 0.5903

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'