Cody

# Problem 6. Select every other element of a vector

Solution 1411589

Submitted on 9 Jan 2018 by RAHUL KOTTATH
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.7204 0.8307 0.7471 0.3416 0.6070

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.8588 0.3283 0.0362 0.6994 0.7146 0.4581 0.5506 0.0443 0.5791 0.2215 0.4703 0.7685 0.3123 0.6555 0.1986 0.0739 0.9079 Columns 18 through 34 0.5493 0.4265 0.5341 0.2583 0.5299 0.7001 0.3335 0.0100 0.4612 0.6441 0.9885 0.2240 0.2516 0.4144 0.9159 0.7064 0.8801 Columns 35 through 50 0.2944 0.0139 0.7247 0.3192 0.4435 0.1274 0.1785 0.2255 0.7739 0.2451 0.6320 0.6845 0.2551 0.8063 0.3558 0.5383

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'