Cody

# Problem 6. Select every other element of a vector

Solution 1946152

Submitted on 23 Sep 2019 by Buket B Karakurt
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.6306 0.5262 0.8806 0.2543 0.5239

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.8870 0.6292 0.2454 0.7958 0.5903 0.6123 0.6144 0.7349 0.5709 0.8929 0.5973 0.0807 0.9795 0.8543 0.1616 0.3321 0.9527 0.1535 Columns 19 through 36 0.8033 0.7443 0.8675 0.2349 0.0919 0.9916 0.6079 0.9907 0.8677 0.5350 0.4166 0.6662 0.9239 0.8744 0.6060 0.5922 0.5607 0.1120 Columns 37 through 50 0.2066 0.1250 0.3218 0.1994 0.8649 0.6229 0.2781 0.6209 0.1955 0.7827 0.7230 0.9571 0.5632 0.8175

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'