Cody

# Problem 6. Select every other element of a vector

Solution 1246727

Submitted on 5 Aug 2017 by David Tandri
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.1511 0.0110 0.2574 0.3982 0.9269

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.3126 0.2686 0.0113 0.1277 0.8974 0.2568 0.8283 0.4782 0.7848 0.4680 0.7169 0.1127 0.0661 0.3097 0.1488 0.4833 0.0427 Columns 18 through 34 0.7890 0.3903 0.5401 0.8714 0.8917 0.9352 0.4580 0.6202 0.8058 0.6136 0.0148 0.5778 0.7736 0.5233 0.9695 0.0637 0.5179 Columns 35 through 50 0.9304 0.1582 0.6827 0.3274 0.7179 0.8880 0.1182 0.5255 0.4417 0.5360 0.7297 0.3459 0.2658 0.7835 0.1460 0.5475

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'