Cody

# Problem 6. Select every other element of a vector

Solution 1708015

Submitted on 17 Jan 2019 by Munish Raj
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.4882 0.5046 0.0120 0.0812 0.5387

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.4958 0.3635 0.2565 0.2450 0.5469 0.1045 0.6898 0.8957 0.9451 0.5346 0.0703 0.5502 0.4880 0.6223 0.6525 0.9030 0.6120 0.8570 Columns 19 through 36 0.5036 0.2208 0.0981 0.0011 0.8551 0.6397 0.6743 0.4056 0.0385 0.4456 0.3703 0.8899 0.8605 0.8663 0.0577 0.9677 0.4306 0.0148 Columns 37 through 50 0.2431 0.8934 0.0500 0.9758 0.8155 0.7271 0.9876 0.9605 0.8872 0.8143 0.2622 0.8463 0.8013 0.5209

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'