Cody

# Problem 6. Select every other element of a vector

Solution 953366

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

x = 0.5872 0.9913 0.5963 0.1659 0.2060

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

x = Columns 1 through 9 0.1458 0.5196 0.3731 0.6660 0.4406 0.1511 0.8894 0.5034 0.3863 Columns 10 through 18 0.4888 0.2160 0.6828 0.2348 0.8500 0.0197 0.7302 0.0213 0.1568 Columns 19 through 27 0.4741 0.7317 0.8227 0.5654 0.1846 0.3272 0.0575 0.3471 0.8441 Columns 28 through 36 0.8402 0.0687 0.2992 0.7344 0.4064 0.5767 0.5899 0.6322 0.7740 Columns 37 through 45 0.6880 0.8436 0.6118 0.0280 0.0127 0.7580 0.0950 0.1323 0.0903 Columns 46 through 50 0.4308 0.4675 0.9165 0.9065 0.6266

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

x = Aogiegiaaayafrwy