Cody

# Problem 6. Select every other element of a vector

Solution 1845143

Submitted on 10 Jun 2019 by Ryan Wilcox
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.7330 0.5634 0.3075 0.3035 0.8370

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.6662 0.0756 0.9717 0.9879 0.5809 0.8791 0.3590 0.3461 0.9432 0.7254 0.2760 0.9047 0.5590 0.5027 0.7818 0.1369 0.9137 0.2869 Columns 19 through 36 0.7794 0.0927 0.6108 0.2679 0.4170 0.3428 0.8011 0.5143 0.6509 0.3067 0.8165 0.6263 0.7881 0.0555 0.8215 0.8591 0.0245 0.4787 Columns 37 through 50 0.9212 0.5198 0.0780 0.1226 0.8620 0.4220 0.4188 0.1888 0.2929 0.0526 0.5127 0.1135 0.4654 0.0305

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'