Cody

# Problem 6. Select every other element of a vector

Solution 1568762

Submitted on 25 Jun 2018 by William Forsberg
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.5180 0.9375 0.1510 0.9735 0.9184

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.9493 0.9069 0.0827 0.4723 0.6168 0.7695 0.7545 0.2618 0.8885 0.3519 0.0544 0.9336 0.3156 0.4409 0.2933 0.0904 0.6651 0.3911 Columns 19 through 36 0.5828 0.5488 0.0947 0.4901 0.8659 0.6409 0.4639 0.9498 0.3738 0.6757 0.6519 0.4097 0.4520 0.1420 0.5689 0.1483 0.2181 0.6031 Columns 37 through 50 0.3052 0.6209 0.8248 0.9499 0.5186 0.4760 0.3886 0.0449 0.0831 0.4320 0.4722 0.3550 0.1354 0.0348

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'