Cody

# Problem 6. Select every other element of a vector

Solution 496418

Submitted on 5 Sep 2014 by Rushikesh Tade
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))

y = 0.9040 0.8025 0.9757 0.8128 0.2695

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

y = Columns 1 through 18 0.8330 0.7098 0.0466 0.7385 0.2196 0.4031 0.1467 0.2146 0.4313 0.4753 0.3801 0.9908 0.4998 0.7715 0.7815 0.0943 0.0897 0.2376 Columns 19 through 36 0.9120 0.4364 0.1756 0.1769 0.7228 0.9671 0.1450 0.0385 0.2191 0.1059 0.7614 0.0088 0.8557 0.9999 0.4308 0.2349 0.0191 0.6755 Columns 37 through 50 0.7609 0.7722 0.6973 0.4740 0.4726 0.1127 0.6476 0.0302 0.3122 0.6452 0.2619 0.6550 0.5368 0.8639

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

y = Aogiegiaaayafrwy