Cody

# Problem 6. Select every other element of a vector

Solution 1900979

Submitted on 15 Aug 2019 by Eilish O'Grady
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))

n = 2 y = 0.1372 0.1384 0.9988 0.5682 0.9814

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

n = 2 y = Columns 1 through 18 0.2151 0.1778 0.1374 0.9712 0.9627 0.8130 0.1111 0.2474 0.5624 0.8020 0.3574 0.0099 0.2764 0.2798 0.1652 0.3307 0.3846 0.2623 Columns 19 through 36 0.3166 0.0347 0.8363 0.3162 0.8995 0.1833 0.6203 0.6574 0.4243 0.3355 0.4910 0.5822 0.8948 0.2600 0.7602 0.5110 0.9870 0.5736 Columns 37 through 50 0.4130 0.2957 0.7677 0.9640 0.6010 0.1190 0.4096 0.4909 0.9549 0.0910 0.5117 0.7334 0.3114 0.6120

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))

n = 2 y = 'Aogiegiaaayafrwy'