Cody

# Problem 6. Select every other element of a vector

Solution 953352

Submitted on 1 Sep 2016 by Gaby
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.3358 0.8208 0.6864 0.3389 0.5539

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

y = Columns 1 through 9 0.9763 0.6628 0.8252 0.2309 0.9917 0.4245 0.0395 0.2254 0.9307 Columns 10 through 18 0.2813 0.0821 0.8855 0.6156 0.3628 0.2496 0.4308 0.1137 0.0605 Columns 19 through 27 0.4854 0.6920 0.4708 0.9105 0.2300 0.3825 0.6300 0.0925 0.3443 Columns 28 through 36 0.5002 0.4629 0.4347 0.4300 0.9296 0.3830 0.6871 0.1163 0.1822 Columns 37 through 45 0.3422 0.0017 0.4150 0.8820 0.7568 0.9230 0.7455 0.7807 0.8387 Columns 46 through 50 0.8449 0.1703 0.1762 0.1956 0.3735

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