Cody

# Problem 6. Select every other element of a vector

Solution 2022754

Submitted on 15 Nov 2019 by Chai Yat Fung
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.3837 0.7017 0.8762 0.5174 0.0913

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.9563 0.1214 0.8875 0.7965 0.9470 0.0652 0.9184 0.1937 0.7496 0.8640 0.0167 0.7154 0.9837 0.9124 0.2745 0.7035 0.6607 0.2157 Columns 19 through 36 0.6057 0.1361 0.7120 0.3753 0.6069 0.7135 0.9354 0.1521 0.9017 0.5142 0.7477 0.5173 0.8919 0.5863 0.0739 0.5344 0.3165 0.4059 Columns 37 through 50 0.0877 0.9860 0.2861 0.1265 0.0327 0.8502 0.6162 0.6096 0.7084 0.3731 0.6532 0.1957 0.0121 0.3851

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'