Cody

# Problem 6. Select every other element of a vector

Solution 1817702

Submitted on 16 May 2019 by Chirag Dudhat
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.0428 0.7474 0.1394 0.1581 0.6512

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.8203 0.5914 0.5063 0.2813 0.2527 0.4817 0.1250 0.6260 0.2375 0.0405 0.0145 0.9753 0.5302 0.0176 0.5805 0.1214 0.5836 Columns 18 through 34 0.5201 0.1314 0.9748 0.3659 0.9731 0.4210 0.0100 0.9678 0.1836 0.2063 0.0909 0.3326 0.3091 0.4037 0.3181 0.4412 0.5666 Columns 35 through 50 0.1415 0.8826 0.2081 0.1741 0.7435 0.1132 0.4252 0.6984 0.7566 0.4726 0.7093 0.3118 0.7635 0.2694 0.3835 0.6047

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'