Cody

# Problem 6. Select every other element of a vector

Solution 1602010

Submitted on 6 Aug 2018 by Ashish Patil
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.4659 0.1817 0.8830 0.3214 0.8509

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.5823 0.0255 0.3641 0.5647 0.5182 0.8654 0.2938 0.2826 0.7087 0.3931 0.2629 0.2495 0.2283 0.2136 0.1222 0.2292 0.4884 0.2824 Columns 19 through 36 0.6521 0.1704 0.8477 0.6718 0.0254 0.4949 0.1012 0.5429 0.9332 0.7896 0.7329 0.5019 0.7736 0.5846 0.6715 0.6503 0.4769 0.4043 Columns 37 through 50 0.5993 0.0711 0.4017 0.8799 0.7011 0.9858 0.6080 0.3698 0.2518 0.3337 0.0145 0.7552 0.1491 0.4801

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'