Cody

# Problem 6. Select every other element of a vector

Solution 1991175

Submitted on 25 Oct 2019 by Antonio Ilardo
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.5384 0.6459 0.8238 0.1118 0.7867

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.6456 0.8277 0.0074 0.5775 0.8717 0.1590 0.6303 0.5914 0.8883 0.0305 0.7450 0.6996 0.5640 0.3471 0.9282 0.8783 0.8811 Columns 18 through 34 0.5712 0.7465 0.8510 0.7888 0.9139 0.9412 0.3581 0.9451 0.8027 0.6112 0.1454 0.6935 0.6748 0.3862 0.7232 0.1180 0.8625 Columns 35 through 50 0.2271 0.1907 0.9702 0.3797 0.0859 0.3078 0.2904 0.1041 0.9116 0.6523 0.6037 0.8853 0.6426 0.8319 0.8578 0.9204

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'