Cody

# Problem 6. Select every other element of a vector

Solution 2010597

Submitted on 9 Nov 2019 by Caitlin Nash
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))

l = 10 y = 0.4002 0.0171 0.5820 0.5811 0.9012

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

l = 100 y = Columns 1 through 18 0.9637 0.6099 0.2076 0.3559 0.8726 0.9346 0.6110 0.5360 0.1975 0.6296 0.2080 0.5046 0.5994 0.3790 0.4470 0.8505 0.9959 0.2555 Columns 19 through 36 0.0018 0.3129 0.2896 0.4532 0.6758 0.1938 0.5454 0.4653 0.5526 0.5412 0.4662 0.5535 0.0212 0.1850 0.4735 0.4263 0.2164 0.1696 Columns 37 through 50 0.2487 0.7524 0.3395 0.5090 0.8863 0.6989 0.9952 0.4098 0.9220 0.6401 0.2638 0.0369 0.5761 0.1918

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))

l = 31 y = 'Aogiegiaaayafrwy'