Cody

# Problem 6. Select every other element of a vector

Solution 1902243

Submitted on 16 Aug 2019 by Daniel Cook
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.6726 0.8066 0.6200 0.1634 0.2409

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

y = Columns 1 through 17 0.0483 0.7902 0.5526 0.3999 0.2419 0.3355 0.0708 0.0929 0.5958 0.8419 0.3692 0.4402 0.2937 0.2603 0.2203 0.4248 0.8575 Columns 18 through 34 0.4677 0.2748 0.7978 0.3052 0.0098 0.0120 0.0933 0.9187 0.8472 0.1236 0.6063 0.4009 0.6964 0.7279 0.1821 0.2397 0.9846 Columns 35 through 50 0.1658 0.9495 0.9134 0.9001 0.4726 0.2204 0.8561 0.6025 0.2493 0.0322 0.4080 0.7036 0.8999 0.7870 0.2722 0.3876

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'