Cody

# Problem 6. Select every other element of a vector

Solution 1277560

Submitted on 27 Sep 2017 by Antonio Natar
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.8937 0.7377 0.4742 0.9880 0.8625

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.8536 0.9464 0.1869 0.3568 0.2051 0.0120 0.5489 0.7763 0.6698 0.8755 0.5371 0.9111 0.6803 0.9301 0.1980 0.6081 0.7587 Columns 18 through 34 0.9148 0.1103 0.3016 0.5832 0.6876 0.2875 0.9625 0.5580 0.8363 0.4719 0.4512 0.1366 0.6619 0.2413 0.8896 0.6724 0.3683 Columns 35 through 50 0.9666 0.9650 0.6842 0.4613 0.1326 0.8659 0.4063 0.5990 0.5952 0.9692 0.2382 0.1147 0.5085 0.6697 0.0820 0.2263

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'