Cody

# Problem 6. Select every other element of a vector

Solution 1979694

Submitted on 17 Oct 2019 by Ngo Minh Ngoc
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.8295 0.4472 0.9682 0.7694 0.2174

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.8978 0.6850 0.8691 0.6206 0.4572 0.2849 0.4567 0.5472 0.4069 0.2652 0.7573 0.6144 0.3086 0.3139 0.7346 0.8875 0.7866 0.1823 Columns 19 through 36 0.7159 0.4491 0.4886 0.9594 0.9827 0.0383 0.9962 0.3600 0.8114 0.5097 0.0247 0.6458 0.2903 0.0687 0.9796 0.9623 0.7579 0.1939 Columns 37 through 50 0.9847 0.4386 0.4300 0.9512 0.9785 0.4509 0.7621 0.6085 0.6915 0.2839 0.0313 0.0164 0.2723 0.9407

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'