Cody

# Problem 6. Select every other element of a vector

Solution 1939804

Submitted on 17 Sep 2019 by Tran Bac
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.6307 0.0392 0.7382 0.4701 0.4849

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.3795 0.1248 0.7468 0.6496 0.9317 0.8813 0.9446 0.6790 0.1125 0.3639 0.4966 0.8973 0.6671 0.2385 0.1912 0.7213 0.9437 0.8558 Columns 19 through 36 0.0550 0.9582 0.5971 0.3521 0.1312 0.8659 0.0494 0.7473 0.7392 0.9572 0.2908 0.5847 0.8306 0.8564 0.7425 0.9104 0.0854 0.2924 Columns 37 through 50 0.9247 0.2456 0.1917 0.2326 0.5242 0.6852 0.3210 0.6360 0.0486 0.6546 0.0695 0.8642 0.7904 0.6425

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'