Cody

Solution 496970

Submitted on 6 Sep 2014 by Redouane
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.6375 0.0691 0.0447 0.9732 0.0010

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.3475 0.1968 0.8206 0.6621 0.7758 0.5013 0.3724 0.0938 0.4859 Columns 10 through 18 0.5135 0.1630 0.9154 0.0321 0.1468 0.7697 0.9143 0.6674 0.1988 Columns 19 through 27 0.8259 0.3548 0.3639 0.1499 0.9583 0.1347 0.3405 0.6607 0.8296 Columns 28 through 36 0.0301 0.5787 0.4900 0.7467 0.9986 0.8880 0.5813 0.6424 0.1145 Columns 37 through 45 0.1467 0.5742 0.6492 0.8884 0.8305 0.9239 0.2896 0.1243 0.6720 Columns 46 through 50 0.6577 0.8592 0.0168 0.5827 0.1906

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

Suggested Problems

More from this Author95