Cody

# Problem 6. Select every other element of a vector

Solution 2093940

Submitted on 15 Jan 2020 by Craig Robertson
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.9863 0.2172 0.0288 0.2127 0.3638

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

y = Columns 1 through 17 0.3000 0.6394 0.5366 0.8888 0.8833 0.6045 0.7538 0.9699 0.7215 0.3492 0.3997 0.4542 0.3540 0.7145 0.5551 0.8191 0.6635 Columns 18 through 34 0.6809 0.9264 0.2228 0.1561 0.2495 0.2235 0.1099 0.5482 0.1764 0.7732 0.6654 0.5427 0.2789 0.7963 0.0454 0.2655 0.0294 Columns 35 through 50 0.3299 0.7948 0.4737 0.3383 0.7895 0.2570 0.4134 0.3646 0.2642 0.8216 0.3580 0.7077 0.1345 0.3831 0.7541 0.5042

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'