Cody

# Problem 6. Select every other element of a vector

Solution 1930995

Submitted on 11 Sep 2019 by David Scherrer
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.6588 0.6279 0.9753 0.6267 0.0567

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.6946 0.9884 0.7323 0.2868 0.1078 0.3540 0.4105 0.8575 0.2131 0.9105 0.7263 0.6925 0.3304 0.0995 0.6539 0.8659 0.8603 0.6432 Columns 19 through 36 0.0192 0.0818 0.9673 0.6209 0.2930 0.2515 0.7712 0.2315 0.1951 0.3591 0.6400 0.0285 0.7513 0.0055 0.4849 0.4593 0.1338 0.6331 Columns 37 through 50 0.0308 0.0484 0.3997 0.0253 0.0306 0.6542 0.7514 0.0562 0.5243 0.4282 0.4609 0.2594 0.2242 0.4280

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'