Cody

Solution 257184

Submitted on 6 Jun 2013 by Jacob
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 = @(x)x(1:2:end) ans = 0.0437 0.4689 0.4159 0.4673 0.7543

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

ans = @(x)x(1:2:end) ans = Columns 1 through 10 0.3389 0.2828 0.8921 0.1397 0.3250 0.1915 0.5880 0.5511 0.3392 0.0273 Columns 11 through 20 0.9700 0.4348 0.0833 0.5572 0.4223 0.7716 0.7542 0.7207 0.1075 0.9800 Columns 21 through 30 0.6655 0.1193 0.6078 0.6567 0.2559 0.8564 0.7657 0.7015 0.8739 0.9715 Columns 31 through 40 0.1546 0.8891 0.1322 0.6769 0.4299 0.0242 0.9757 0.4953 0.7890 0.9539 Columns 41 through 50 0.7626 0.9640 0.8625 0.6307 0.6465 0.9047 0.7715 0.2791 0.0730 0.6255

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 = @(x)x(1:2:end) ans = Aogiegiaaayafrwy