Cody

# Problem 6. Select every other element of a vector

Solution 592111

Submitted on 5 Mar 2015 by Tyler Sproule
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.6454 0.1049 0.2839 0.9690 0.5146

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

y = Columns 1 through 9 0.8009 0.6466 0.5314 0.9694 0.3247 0.0496 0.9009 0.6860 0.2398 Columns 10 through 18 0.2172 0.5590 0.3837 0.4303 0.5879 0.6714 0.1495 0.4411 0.6772 Columns 19 through 27 0.8871 0.4685 0.1564 0.4464 0.1199 0.6942 0.1260 0.1095 0.5275 Columns 28 through 36 0.7346 0.9768 0.9029 0.8994 0.8632 0.6947 0.0153 0.1869 0.4885 Columns 37 through 45 0.3865 0.1991 0.2708 0.5760 0.3807 0.2077 0.4480 0.8767 0.7221 Columns 46 through 50 0.3341 0.8517 0.2979 0.1154 0.5199

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