Cody

# Problem 6. Select every other element of a vector

Solution 2049747

Submitted on 7 Dec 2019 by Shreshtha Agarwal
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.4917 0.5597 0.6073 0.1850 0.0849

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.4473 0.9365 0.6340 0.3001 0.2648 0.6674 0.8329 0.5701 0.7571 0.5269 0.0662 0.2957 0.4422 0.5013 0.5116 0.2655 0.8526 Columns 18 through 34 0.2496 0.6036 0.9838 0.7903 0.9256 0.7346 0.2900 0.0940 0.7428 0.5880 0.6417 0.0861 0.7741 0.2551 0.6262 0.0306 0.6844 Columns 35 through 50 0.8641 0.0293 0.4958 0.8518 0.1807 0.2325 0.4668 0.2887 0.9607 0.5431 0.0359 0.1927 0.1500 0.8261 0.9813 0.8008

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'