Cody

# Problem 6. Select every other element of a vector

Solution 2145196

Submitted on 29 Feb 2020 by Paul Hauska
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.3617 0.7693 0.1197 0.4626 0.2938

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.0648 0.6107 0.2834 0.8276 0.2051 0.9994 0.1819 0.2640 0.0648 0.1114 0.5140 0.4739 0.5750 0.5560 0.5196 0.6863 0.2927 Columns 18 through 34 0.1292 0.8953 0.8765 0.0918 0.9329 0.4079 0.3651 0.0523 0.4186 0.7064 0.3564 0.9522 0.4805 0.4361 0.1690 0.8349 0.0641 Columns 35 through 50 0.9004 0.8989 0.0649 0.4852 0.5072 0.3676 0.5593 0.1731 0.4620 0.3015 0.9437 0.6125 0.6430 0.0115 0.2990 0.4882

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'