Cody

# Problem 6. Select every other element of a vector

Solution 1880371

Submitted on 21 Jul 2019 by ahmed hany
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.1976 0.8565 0.3228 0.1536 0.8772

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.6308 0.6810 0.3987 0.5551 0.8799 0.6381 0.5540 0.8487 0.0025 0.6594 0.2207 0.3436 0.3573 0.9928 0.0550 0.3670 0.2364 0.8373 Columns 19 through 36 0.6161 0.6842 0.7707 0.3173 0.6523 0.6404 0.1792 0.8055 0.3128 0.1456 0.7885 0.6935 0.3020 0.7134 0.9059 0.9780 0.0977 0.3997 Columns 37 through 50 0.8979 0.4624 0.8389 0.5647 0.0874 0.5938 0.6417 0.3592 0.1578 0.4755 0.0813 0.8047 0.0282 0.3276

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'