Cody

# Problem 6. Select every other element of a vector

Solution 1818376

Submitted on 17 May 2019 by Hamdi Haouachi
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.0374 0.6680 0.3149 0.8146 0.3834

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.4251 0.7491 0.7888 0.4531 0.8408 0.7981 0.9396 0.8552 0.0923 0.2062 0.7545 0.7654 0.2898 0.2322 0.6460 0.6004 0.7092 0.7334 Columns 19 through 36 0.7957 0.5529 0.7607 0.6546 0.9509 0.8833 0.5803 0.6602 0.3701 0.0590 0.2893 0.9923 0.0547 0.6023 0.5300 0.2410 0.0260 0.4711 Columns 37 through 50 0.2249 0.1973 0.6970 0.9526 0.8901 0.5205 0.1233 0.9036 0.8444 0.4855 0.2844 0.3512 0.2287 0.0176

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'