Cody

# Problem 6. Select every other element of a vector

Solution 1035796

Submitted on 28 Oct 2016 by Sagar Rupapara
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.8188 0.2211 0.7660 0.0558 0.9448

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

y = Columns 1 through 9 0.9306 0.1053 0.2292 0.9673 0.7678 0.5261 0.2062 0.0451 0.6987 Columns 10 through 18 0.9983 0.0894 0.4539 0.1955 0.9322 0.0496 0.4977 0.3294 0.2254 Columns 19 through 27 0.9994 0.0957 0.7837 0.4564 0.8223 0.4716 0.5932 0.5205 0.6355 Columns 28 through 36 0.3521 0.6916 0.5718 0.9874 0.1612 0.6728 0.1360 0.1198 0.7409 Columns 37 through 45 0.6616 0.6499 0.3196 0.3135 0.1099 0.8264 0.9213 0.0848 0.2716 Columns 46 through 50 0.4602 0.9804 0.2046 0.1847 0.5247

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