Cody

# Problem 6. Select every other element of a vector

Solution 1877766

Submitted on 18 Jul 2019 by Mathis Weyrich
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.9346 0.0890 0.3466 0.4151 0.9106

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

y = Columns 1 through 18 0.7600 0.9966 0.6190 0.3970 0.0199 0.2911 0.9526 0.9758 0.4768 0.1177 0.3076 0.3172 0.5042 0.8549 0.4766 0.4855 0.4061 0.0245 Columns 19 through 36 0.5072 0.3349 0.6043 0.3949 0.3529 0.2932 0.3959 0.3871 0.0167 0.4048 0.4978 0.3752 0.9642 0.1164 0.7859 0.8803 0.5732 0.3982 Columns 37 through 50 0.6748 0.3479 0.6856 0.9601 0.1722 0.6502 0.3309 0.0187 0.5522 0.8281 0.5664 0.3961 0.4591 0.6466

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'