Cody

# Problem 6. Select every other element of a vector

Solution 1669657

Submitted on 8 Nov 2018 by Sharon Spelt
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.8739 0.5717 0.4427 0.3582 0.4416

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.1522 0.1603 0.3722 0.3655 0.7055 0.2864 0.5531 0.9070 0.2467 0.4996 0.8525 0.9887 0.5350 0.4146 0.9791 0.9032 0.0444 0.1609 Columns 19 through 36 0.9701 0.0786 0.8524 0.0191 0.5967 0.0826 0.0060 0.7092 0.3207 0.7278 0.9933 0.2959 0.1823 0.2199 0.0794 0.1196 0.8590 0.6773 Columns 37 through 50 0.6778 0.2460 0.8921 0.8419 0.4732 0.2612 0.4423 0.4153 0.1722 0.9684 0.4256 0.3259 0.9069 0.1792

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'