Cody

# Problem 6. Select every other element of a vector

Solution 954639

Submitted on 2 Sep 2016 by Alisa Housková
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.2231 0.2000 0.1967 0.9645 0.7193

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.1452 0.1750 0.8657 0.4351 0.3656 0.5565 0.7104 0.9735 0.9500 Columns 10 through 18 0.5603 0.8716 0.5771 0.3110 0.8966 0.5151 0.1256 0.5689 0.4881 Columns 19 through 27 0.9159 0.3440 0.8083 0.7078 0.2553 0.9286 0.9714 0.3614 0.0241 Columns 28 through 36 0.7902 0.3967 0.9363 0.9864 0.8561 0.8420 0.2642 0.4791 0.1504 Columns 37 through 45 0.0693 0.0182 0.4004 0.2580 0.9124 0.1389 0.5043 0.1654 0.5298 Columns 46 through 50 0.2795 0.9161 0.3746 0.2239 0.1640

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