Cody

# Problem 6. Select every other element of a vector

Solution 916550

Submitted on 29 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.1089 0.7067 0.5017 0.6914 0.6905

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.3379 0.3214 0.6319 0.5223 0.6711 0.2702 0.4261 0.9695 0.7435 Columns 10 through 18 0.4536 0.8860 0.6096 0.3712 0.1921 0.5309 0.0952 0.8777 0.2757 Columns 19 through 27 0.2694 0.6734 0.9517 0.5550 0.4443 0.2571 0.9436 0.4993 0.5567 Columns 28 through 36 0.6289 0.2506 0.9695 0.6062 0.7067 0.5351 0.8689 0.3770 0.0234 Columns 37 through 45 0.0820 0.0850 0.4990 0.4629 0.6795 0.2804 0.2578 0.2217 0.3822 Columns 46 through 50 0.0876 0.2822 0.8964 0.4168 0.6647

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