Cody

# Problem 6. Select every other element of a vector

Solution 1773586

Submitted on 4 Apr 2019 by Jonathan Udell
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.9188 0.4725 0.5512 0.3600 0.6414

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.8117 0.7355 0.7800 0.7333 0.1273 0.9200 0.0308 0.6589 0.3698 0.3870 0.0671 0.9469 0.7824 0.8459 0.7709 0.4726 0.3344 0.9951 Columns 19 through 36 0.4292 0.6980 0.0459 0.0158 0.7036 0.1777 0.4327 0.8080 0.5376 0.2029 0.0937 0.5493 0.6949 0.4098 0.5113 0.0854 0.4750 0.0430 Columns 37 through 50 0.2453 0.6388 0.6005 0.2847 0.6023 0.0165 0.7764 0.6632 0.6431 0.2867 0.5638 0.8147 0.3623 0.0642

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'