Cody

# Problem 6. Select every other element of a vector

Solution 2029440

Submitted on 20 Nov 2019 by James Kelly
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.7616 0.2069 0.3975 0.1829 0.7847

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.5187 0.7287 0.5408 0.8300 0.8222 0.0494 0.3694 0.1668 0.2019 0.8403 0.2022 0.7349 0.0895 0.7608 0.4263 0.6578 0.8219 0.4827 Columns 19 through 36 0.0335 0.4841 0.0223 0.7582 0.3092 0.7229 0.2392 0.4906 0.2913 0.0537 0.8049 0.8866 0.5007 0.0185 0.3677 0.6923 0.7794 0.8079 Columns 37 through 50 0.1931 0.1482 0.3397 0.2788 0.1243 0.6901 0.3581 0.8761 0.7385 0.9590 0.0216 0.7330 0.9829 0.8189

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'