Cody

# Problem 6. Select every other element of a vector

Solution 1879557

Submitted on 20 Jul 2019 by Jeevanandh Vijayan
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.1380 0.8100 0.1653 0.9876 0.1991

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.0958 0.5531 0.5562 0.2916 0.6049 0.2070 0.8165 0.3416 0.6893 0.3270 0.5023 0.5383 0.5376 0.5086 0.5960 0.4545 0.8654 0.1772 Columns 19 through 36 0.0637 0.5012 0.0266 0.8538 0.1795 0.8955 0.1573 0.8570 0.9774 0.8353 0.3829 0.1280 0.3111 0.7796 0.7365 0.7963 0.6642 0.9250 Columns 37 through 50 0.7351 0.6862 0.5885 0.8188 0.0960 0.1182 0.0676 0.6620 0.7250 0.3419 0.6098 0.5464 0.1603 0.1562

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'