Cody

# Problem 6. Select every other element of a vector

Solution 1636838

Submitted on 2 Oct 2018 by Julian Hapke
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))

x = 0.2312 0.0797 0.2769 0.4497 0.8137

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

x = Columns 1 through 18 0.3959 0.1523 0.5342 0.4305 0.2170 0.7160 0.4459 0.7589 0.2629 0.4594 0.9583 0.7959 0.0151 0.8727 0.5444 0.3511 0.2964 0.2633 Columns 19 through 36 0.4778 0.6952 0.5957 0.2578 0.2286 0.9127 0.3422 0.4539 0.1753 0.2129 0.3664 0.3259 0.0345 0.1062 0.0613 0.7824 0.2160 0.2112 Columns 37 through 50 0.8825 0.0096 0.0673 0.7715 0.0350 0.2409 0.7050 0.6763 0.4342 0.0340 0.3857 0.7729 0.4567 0.7133

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

x = 'Aogiegiaaayafrwy'