Cody

# Problem 6. Select every other element of a vector

Solution 1856655

Submitted on 24 Jun 2019 by Chris Hahn
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.4463 0.3005 0.7570 0.0504 0.5639

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.1972 0.9458 0.7675 0.1171 0.4360 0.2063 0.8508 0.3872 0.1958 0.0993 0.9718 0.7682 0.8231 0.3317 0.7863 0.6592 0.1091 0.4671 Columns 19 through 36 0.0368 0.8009 0.5694 0.9184 0.3843 0.8704 0.5426 0.0262 0.3689 0.5444 0.3732 0.3434 0.9668 0.8620 0.0505 0.2463 0.3625 0.8302 Columns 37 through 50 0.6921 0.7375 0.7057 0.2964 0.2329 0.2929 0.8302 0.8036 0.1663 0.3440 0.8357 0.1084 0.4084 0.1160

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'