Cody

# Problem 6. Select every other element of a vector

Solution 610612

Submitted on 2 Apr 2015 by Przyczajony Tygrys, Ukryty Smok
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.4882 0.6440 0.1741 0.8664 0.9101

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.2353 0.7343 0.0053 0.2483 0.8397 0.3913 0.0264 0.9651 0.5427 0.2134 0.4450 0.4006 0.7157 0.1035 0.7958 0.2826 0.3839 0.6485 Columns 19 through 36 0.2569 0.9839 0.0354 0.1722 0.4231 0.6118 0.3255 0.1685 0.8778 0.1656 0.2831 0.9026 0.7235 0.7914 0.8361 0.9891 0.9165 0.2895 Columns 37 through 50 0.3451 0.4115 0.0281 0.0664 0.3455 0.4585 0.6311 0.5388 0.9097 0.7211 0.5901 0.7903 0.7408 0.4550

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