Cody

# Problem 6. Select every other element of a vector

Solution 768744

Submitted on 30 Oct 2015 by Soner Ulun
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.5728 0.7166 0.6462 0.9347 0.5881

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

y = Columns 1 through 9 0.2529 0.5881 0.0593 0.0689 0.6595 0.5230 0.0114 0.1634 0.5912 Columns 10 through 18 0.2998 0.4828 0.7326 0.1429 0.2522 0.5384 0.0469 0.8674 0.7016 Columns 19 through 27 0.8102 0.0915 0.6603 0.5895 0.2890 0.8747 0.0117 0.5678 0.8927 Columns 28 through 36 0.9596 0.2557 0.3607 0.0941 0.6713 0.7240 0.8175 0.8236 0.0956 Columns 37 through 45 0.3693 0.9151 0.6860 0.9975 0.0557 0.6602 0.9554 0.3858 0.3472 Columns 46 through 50 0.6150 0.8255 0.0360 0.2905 0.6923

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