Cody

Solution 257164

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

f = @(x)x(1:2:end) f = 0.2523 0.7455 0.8046 0.2336 0.2052

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

f = @(x)x(1:2:end) f = Columns 1 through 10 0.6804 0.0208 0.3070 0.3519 0.8323 0.3735 0.6185 0.3989 0.8980 0.5272 Columns 11 through 20 0.3427 0.9234 0.5938 0.3500 0.7813 0.3841 0.4668 0.6548 0.5179 0.6191 Columns 21 through 30 0.2688 0.7594 0.0419 0.1640 0.2302 0.6952 0.4584 0.4480 0.8903 0.3340 Columns 31 through 40 0.7893 0.1126 0.9761 0.4720 0.5955 0.8498 0.0774 0.8791 0.6794 0.4937 Columns 41 through 50 0.2752 0.3849 0.3546 0.9952 0.7863 0.2633 0.6042 0.8080 0.0338 0.5524

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

f = @(x)x(1:2:end) f = Aogiegiaaayafrwy

Suggested Problems

More from this Author95