Cody

# Problem 6. Select every other element of a vector

Solution 1899967

Submitted on 14 Aug 2019 by Andreas Neul
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.2298 0.9394 0.0024 0.4589 0.2147

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.1878 0.1280 0.0028 0.7478 0.3950 0.1663 0.2038 0.4373 0.6571 0.7048 0.0195 0.8022 0.5417 0.3930 0.7051 0.9996 0.4102 0.6282 Columns 19 through 36 0.8304 0.8227 0.3495 0.0448 0.2406 0.6171 0.9837 0.0567 0.6065 0.8763 0.5501 0.3623 0.6659 0.7663 0.6881 0.5605 0.0159 0.4715 Columns 37 through 50 0.7223 0.3388 0.3622 0.9589 0.8859 0.7354 0.6476 0.1504 0.4702 0.5195 0.4930 0.9777 0.6052 0.7540

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'