Cody

# Problem 6. Select every other element of a vector

Solution 1703796

Submitted on 7 Jan 2019 by Mohan V
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.0000 0.4744 0.7340 0.9891 0.7749

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.1671 0.0649 0.9946 0.4131 0.7669 0.5173 0.7645 0.2345 0.6666 0.4894 0.0234 0.8304 0.8695 0.4854 0.8629 0.6246 0.8025 0.4306 Columns 19 through 36 0.8185 0.3034 0.9704 0.4352 0.5275 0.7243 0.6138 0.5495 0.3562 0.4366 0.6877 0.1034 0.8508 0.0717 0.5296 0.9388 0.8295 0.5926 Columns 37 through 50 0.8819 0.0644 0.3649 0.6065 0.2945 0.5625 0.2308 0.7672 0.1037 0.6742 0.5482 0.8096 0.3376 0.2300

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'