Cody

# Problem 6. Select every other element of a vector

Solution 1111230

Submitted on 27 Jan 2017 by Alexander Levedahl
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))

ans = 0.9155 0.6161 0.7752 0.4918 0.8271

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

ans = Columns 1 through 9 0.9107 0.1307 0.0394 0.3674 0.2074 0.6684 0.7898 0.5732 0.5145 Columns 10 through 18 0.1029 0.2326 0.7063 0.1402 0.2960 0.7764 0.8273 0.0066 0.9432 Columns 19 through 27 0.3521 0.4060 0.3921 0.2431 0.1081 0.1964 0.3768 0.8666 0.9370 Columns 28 through 36 0.3480 0.1078 0.2920 0.5143 0.3678 0.0342 0.3974 0.7217 0.2714 Columns 37 through 45 0.7901 0.9772 0.5382 0.1492 0.1329 0.7036 0.0705 0.6226 0.4412 Columns 46 through 50 0.1234 0.1274 0.2243 0.5290 0.3455

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

ans = Aogiegiaaayafrwy