Cody

# Problem 6. Select every other element of a vector

Solution 1913630

Submitted on 27 Aug 2019 by Ryan McBurney
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.0691 0.6716 0.8417 0.3629 0.8362

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.8747 0.1904 0.3415 0.9990 0.4208 0.0262 0.0910 0.5969 0.8002 0.4326 0.5095 0.6916 0.6426 0.9010 0.0939 0.3050 0.4142 0.1754 Columns 19 through 36 0.0635 0.5516 0.2289 0.3277 0.4539 0.3517 0.8237 0.5686 0.3457 0.6559 0.2712 0.0860 0.5101 0.8004 0.1373 0.2420 0.9008 0.2845 Columns 37 through 50 0.6263 0.1755 0.1101 0.9734 0.4802 0.6054 0.0396 0.4740 0.9563 0.5736 0.8465 0.6511 0.6929 0.3363

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'