Cody

# Problem 6. Select every other element of a vector

Solution 1232087

Submitted on 15 Jul 2017 by Loris Chavée
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.9849 0.1059 0.5159 0.3680 0.9989

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.5486 0.1435 0.9214 0.1124 0.2243 0.8327 0.0486 0.3734 0.9142 0.0006 0.6727 0.5085 0.4745 0.6799 0.7018 0.3908 0.0487 Columns 18 through 34 0.4756 0.3693 0.2132 0.5516 0.5146 0.3128 0.8909 0.6687 0.2958 0.4102 0.6868 0.9061 0.2492 0.3226 0.8559 0.0712 0.6721 Columns 35 through 50 0.5572 0.8341 0.3331 0.0269 0.8432 0.9995 0.4462 0.4442 0.0179 0.9140 0.7051 0.1184 0.3521 0.7203 0.4646 0.9768

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'