Cody

# Problem 6. Select every other element of a vector

Solution 887196

Submitted on 7 May 2016 by pranju chakrapani
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.4396 0.1020 0.3994 0.7462 0.3303

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.7448 0.1809 0.4076 0.6418 0.5950 0.6173 0.2226 0.3111 0.5862 0.7115 0.5541 0.9043 0.2391 0.5817 0.5591 0.7687 0.5913 Columns 18 through 34 0.2148 0.9370 0.4146 0.3932 0.2808 0.9147 0.7235 0.6442 0.7953 0.7901 0.2698 0.3893 0.7134 0.5806 0.7480 0.4145 0.3708 Columns 35 through 50 0.2356 0.0593 0.1828 0.0388 0.2766 0.9634 0.2187 0.1181 0.0269 0.6236 0.6741 0.8613 0.0131 0.9538 0.6952 0.3190

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