Cody

# Problem 6. Select every other element of a vector

Solution 1050642

Submitted on 11 Nov 2016 by Jean-Christophe
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.0273 0.4820 0.6252 0.9533 0.0182

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.3205 0.3160 0.5567 0.3443 0.6028 0.8206 0.7466 0.6500 0.9523 0.8681 0.0047 0.7277 0.0284 0.6427 0.8673 0.9461 0.8820 Columns 18 through 34 0.4764 0.3944 0.2026 0.4707 0.6119 0.8740 0.5184 0.8416 0.4138 0.1007 0.0868 0.1289 0.9036 0.1659 0.5668 0.5670 0.9726 Columns 35 through 50 0.8033 0.4338 0.4663 0.7395 0.9632 0.3570 0.1804 0.1536 0.3775 0.1279 0.5668 0.2031 0.9813 0.1356 0.1106 0.8759

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