Cody

# Problem 6. Select every other element of a vector

Solution 1757655

Submitted on 22 Mar 2019 by zo lin
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.5093 0.5996 0.3080 0.5259 0.7833

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.6465 0.6556 0.0822 0.6249 0.8131 0.6410 0.0415 0.2394 0.9295 0.8444 0.0842 0.5486 0.6136 0.0061 0.2236 0.5437 0.5667 Columns 18 through 34 0.4694 0.1702 0.2910 0.5442 0.4845 0.0532 0.3847 0.5912 0.7381 0.1534 0.2263 0.5735 0.5173 0.2957 0.8027 0.1161 0.8631 Columns 35 through 50 0.9451 0.2364 0.7707 0.4561 0.2699 0.6678 0.2698 0.9826 0.2635 0.2799 0.3557 0.6907 0.0512 0.0227 0.6105 0.2952

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'