Cody

# Problem 6. Select every other element of a vector

Solution 1848899

Submitted on 13 Jun 2019 by David Kumiega
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.8195 0.2266 0.1418 0.4878 0.0082

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.9295 0.0174 0.9135 0.7023 0.0043 0.4373 0.9883 0.9821 0.7878 0.2429 0.2946 0.5412 0.1846 0.3784 0.8863 0.8592 0.6047 0.8495 Columns 19 through 36 0.8368 0.1379 0.0723 0.7997 0.8752 0.6956 0.3554 0.7122 0.5253 0.9265 0.7728 0.1756 0.7894 0.1095 0.2792 0.1617 0.3436 0.4467 Columns 37 through 50 0.0597 0.5733 0.3788 0.6115 0.0263 0.7092 0.8770 0.2544 0.5500 0.4116 0.7152 0.8358 0.6352 0.7757

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'