Cody

# Problem 6. Select every other element of a vector

Solution 1957134

Submitted on 3 Oct 2019 by lewis liang
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.3548 0.4308 0.9207 0.1040

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.1586 0.3335 0.4594 0.1190 0.0600 0.7405 0.6915 0.4389 0.7647 0.9272 0.0522 0.1119 0.9084 0.6415 0.7865 0.5033 0.2038 Columns 18 through 34 0.6025 0.3890 0.8353 0.9787 0.1205 0.7812 0.2959 0.7049 0.1257 0.8452 0.9339 0.2158 0.1271 0.9070 0.7963 0.5187 0.0129 Columns 35 through 50 0.1480 0.2402 0.8021 0.1905 0.7606 0.7753 0.2941 0.1637 0.2602 0.8025 0.7330 0.9683 0.5310 0.1717 0.4228 0.7639

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'