Cody

# Problem 6. Select every other element of a vector

Solution 2031635

Submitted on 22 Nov 2019 by Peter Wight
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.9653 0.0519 0.9395 0.7566 0.6190

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.5009 0.7027 0.0616 0.8456 0.2623 0.8064 0.8591 0.3245 0.9957 0.1722 0.3272 0.4642 0.9581 0.4443 0.0047 0.5015 0.5525 0.6520 Columns 19 through 36 0.5827 0.0746 0.3824 0.4655 0.5063 0.8627 0.9462 0.2496 0.0515 0.8444 0.1997 0.0049 0.5673 0.0890 0.4924 0.8695 0.4203 0.9836 Columns 37 through 50 0.4108 0.8870 0.6876 0.1994 0.4011 0.3474 0.9223 0.6410 0.1423 0.5277 0.1851 0.9996 0.6805 0.7293

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'