Cody

# Problem 6. Select every other element of a vector

Solution 2028254

Submitted on 19 Nov 2019 by Ian O Neill
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.7193 0.7862 0.4448 0.3793 0.9793

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.1973 0.7940 0.6340 0.9013 0.2795 0.6556 0.2752 0.9476 0.4136 0.3906 0.2109 0.4770 0.0898 0.5127 0.7398 0.8076 0.1453 Columns 18 through 34 0.0927 0.0867 0.9144 0.8997 0.0521 0.1688 0.7337 0.5227 0.9780 0.1887 0.4722 0.4340 0.7155 0.9411 0.1286 0.7144 0.2315 Columns 35 through 50 0.4389 0.3146 0.5456 0.3820 0.9176 0.4970 0.6888 0.6621 0.7940 0.9804 0.6251 0.3486 0.4768 0.0175 0.4026 0.8326

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'