Cody

# Problem 6. Select every other element of a vector

Solution 1985512

Submitted on 22 Oct 2019 by asa czylabson
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.3917 0.8390 0.3570 0.1841 0.4452

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.7469 0.9220 0.7089 0.9852 0.3954 0.3904 0.7793 0.3130 0.9267 0.7088 0.7353 0.1869 0.4161 0.3131 0.9190 0.2901 0.7720 0.9219 Columns 19 through 36 0.3377 0.3549 0.3994 0.6659 0.8173 0.5407 0.9352 0.8615 0.4853 0.9804 0.1476 0.3823 0.5460 0.7932 0.0446 0.4820 0.0324 0.6453 Columns 37 through 50 0.8950 0.2990 0.7286 0.0175 0.0253 0.2639 0.2094 0.4041 0.1227 0.6106 0.9915 0.4158 0.7794 0.4020

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'