Cody

Solution 135822

Submitted on 6 Sep 2012 by Matthew
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))

ans = 0.8401 0.2891 0.9149 0.8350 0.3445

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

ans = Columns 1 through 9 0.0431 0.8491 0.5680 0.5968 0.2840 0.9513 0.2897 0.4777 0.5377 Columns 10 through 18 0.6820 0.3119 0.8614 0.4306 0.1065 0.9441 0.2421 0.9997 0.3294 Columns 19 through 27 0.4004 0.3963 0.7050 0.4932 0.1054 0.7855 0.0417 0.4999 0.7264 Columns 28 through 36 0.5665 0.3801 0.8960 0.3650 0.5165 0.1156 0.6871 0.1749 0.6886 Columns 37 through 45 0.9927 0.0195 0.6974 0.5095 0.6125 0.4241 0.9053 0.9236 0.8977 Columns 46 through 50 0.5536 0.3044 0.8061 0.1498 0.0742

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

ans = Aogiegiaaayafrwy