Cody

# Problem 6. Select every other element of a vector

Solution 1846982

Submitted on 12 Jun 2019 by William Scott
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.8678 0.7352 0.3832 0.5359 0.0574

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.3782 0.9456 0.0119 0.6394 0.4253 0.3828 0.2607 0.8282 0.2928 0.8723 0.2855 0.2267 0.3300 0.0584 0.6796 0.9033 0.3117 0.6284 Columns 19 through 36 0.3776 0.2208 0.2895 0.3857 0.1921 0.2220 0.0448 0.5303 0.1350 0.2350 0.5754 0.4328 0.8277 0.1840 0.6541 0.6248 0.2301 0.7997 Columns 37 through 50 0.9907 0.9507 0.6414 0.2751 0.3921 0.6427 0.9917 0.4675 0.5245 0.9030 0.4077 0.0677 0.3969 0.1921

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'