Cody

# Problem 6. Select every other element of a vector

Solution 1979420

Submitted on 16 Oct 2019 by Alexandra Ellis
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.5470 0.5204 0.4909 0.7165 0.7828

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.2940 0.1974 0.0144 0.9390 0.8803 0.5736 0.1550 0.2398 0.1383 0.7480 0.9953 0.8525 0.3958 0.9005 0.2932 0.6058 0.5479 Columns 18 through 34 0.6559 0.8527 0.2732 0.7282 0.1664 0.9819 0.6280 0.4190 0.1598 0.5943 0.2198 0.3028 0.9478 0.7840 0.6676 0.6261 0.7541 Columns 35 through 50 0.5690 0.3232 0.4960 0.3127 0.1560 0.2463 0.7094 0.5794 0.4775 0.8436 0.5216 0.6677 0.0272 0.5870 0.7628 0.5932

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'