Cody

# Problem 6. Select every other element of a vector

Solution 1951676

Submitted on 28 Sep 2019 by Trung Luu Van
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.6676 0.1915 0.8153 0.4807 0.9023

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.0934 0.3772 0.1328 0.2733 0.1328 0.7481 0.5454 0.3623 0.7722 0.8080 0.5136 0.2363 0.4207 0.7884 0.8325 0.5880 0.9482 0.6379 Columns 19 through 36 0.6575 0.7881 0.4476 0.2139 0.9327 0.5216 0.4309 0.6015 0.3561 0.4173 0.2869 0.9491 0.8981 0.2277 0.2199 0.2649 0.2589 0.4982 Columns 37 through 50 0.6584 0.0318 0.4552 0.9788 0.3353 0.0061 0.7269 0.4074 0.9032 0.0159 0.8773 0.7556 0.2576 0.1853

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'