Cody

Solution 23997

Submitted on 2 Feb 2012 by Jeff
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

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

index = 1 3 5 7 9

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

index = Columns 1 through 10 1 3 5 7 9 11 13 15 17 19 Columns 11 through 20 21 23 25 27 29 31 33 35 37 39 Columns 21 through 30 41 43 45 47 49 51 53 55 57 59 Columns 31 through 40 61 63 65 67 69 71 73 75 77 79 Columns 41 through 50 81 83 85 87 89 91 93 95 97 99

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

index = Columns 1 through 10 1 3 5 7 9 11 13 15 17 19 Columns 11 through 16 21 23 25 27 29 31

More from this Author95