Cody

# Problem 6. Select every other element of a vector

Solution 1172678

Submitted on 26 Apr 2017 by Md.Farhad Hassan
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))

f = 0.4781 0.8004 0.7974 0.4443 0.8786

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

f = Columns 1 through 17 0.6781 0.3916 0.0202 0.9237 0.4894 0.5443 0.8931 0.0544 0.4454 0.5996 0.1153 0.8742 0.5057 0.3836 0.1554 0.6080 0.5182 Columns 18 through 34 0.8910 0.3011 0.9743 0.3290 0.1492 0.8692 0.5456 0.9593 0.5101 0.0782 0.0182 0.5589 0.9944 0.3503 0.6842 0.4392 0.7193 Columns 35 through 50 0.5352 0.4986 0.0033 0.8829 0.0582 0.6603 0.1101 0.6412 0.5084 0.0286 0.7472 0.8688 0.3415 0.0764 0.4443 0.3184

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

f = 'Aogiegiaaayafrwy'