Cody

# Problem 6. Select every other element of a vector

Solution 1544233

Submitted on 30 May 2018 by Lewis Moran
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.7798 0.0794 0.2784 0.7286 0.2514

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.1592 0.4802 0.5960 0.5866 0.8071 0.9808 0.8365 0.9835 0.8312 0.7591 0.0075 0.6060 0.3650 0.9936 0.9485 0.4757 0.4850 0.6184 Columns 19 through 36 0.1059 0.5349 0.6811 0.5991 0.5065 0.2639 0.3727 0.1153 0.2559 0.8377 0.6722 0.8921 0.2332 0.5619 0.5974 0.3457 0.8709 0.7720 Columns 37 through 50 0.4239 0.3165 0.6334 0.6043 0.9801 0.4073 0.2052 0.2654 0.0423 0.8304 0.7264 0.2543 0.0761 0.0024

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' y = 'Aogiegiaaayafrwy'