Cody

# Problem 6. Select every other element of a vector

Solution 1951974

Submitted on 28 Sep 2019 by Le Manh Long Le Manh Long
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))

m = 10 y = 0.7076 0.6217 0.2996 0.9486 0.5945

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

m = 100 y = Columns 1 through 18 0.0395 0.7126 0.9699 0.8976 0.1157 0.8913 0.2746 0.1050 0.3740 0.8788 0.2353 0.1124 0.2531 0.8218 0.7526 0.5112 0.9975 0.7528 Columns 19 through 36 0.7374 0.8001 0.2025 0.0699 0.6233 0.8336 0.1415 0.1687 0.1722 0.5883 0.4930 0.5837 0.3611 0.9795 0.8015 0.8283 0.9448 0.8849 Columns 37 through 50 0.9043 0.3944 0.4497 0.7351 0.3874 0.0046 0.1817 0.2553 0.1861 0.6305 0.6868 0.4240 0.0476 0.9965

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))

m = 31 y = 'Aogiegiaaayafrwy'