Cody

# Problem 6. Select every other element of a vector

Solution 1399558

Submitted on 31 Dec 2017 by Jafar Ala
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.5233 0.5409 0.8945 0.0480 0.0320

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

y = Columns 1 through 17 0.1130 0.1892 0.7632 0.7761 0.1349 0.7625 0.8767 0.4850 0.5848 0.5162 0.7938 0.1182 0.0359 0.7182 0.8129 0.6345 0.6598 Columns 18 through 34 0.4746 0.1004 0.7144 0.3937 0.9356 0.2290 0.5215 0.5189 0.6916 0.5742 0.8634 0.8867 0.6640 0.6260 0.8521 0.8678 0.6050 Columns 35 through 50 0.2065 0.6092 0.9033 0.9470 0.2558 0.5492 0.9096 0.4841 0.0996 0.5335 0.0646 0.1008 0.8631 0.7257 0.7890 0.3871

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'