Cody

# Problem 6. Select every other element of a vector

Solution 1842351

Submitted on 8 Jun 2019 by Xuan Yee
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.6345 0.8019 0.9015 0.3850 0.1201

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.0640 0.8651 0.4078 0.0402 0.4266 0.5688 0.0791 0.7925 0.5221 0.9536 0.9147 0.2951 0.3737 0.1018 0.0067 0.6048 0.0371 0.7683 Columns 19 through 36 0.4399 0.5096 0.0071 0.2361 0.8285 0.4726 0.0509 0.7341 0.2053 0.8220 0.8977 0.7065 0.7655 0.8020 0.2530 0.7250 0.8453 0.0795 Columns 37 through 50 0.5130 0.0809 0.3362 0.0918 0.0388 0.7119 0.3401 0.6616 0.0524 0.2176 0.5007 0.4109 0.8140 0.4599

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'