Cody

# Problem 6. Select every other element of a vector

Solution 917273

Submitted on 30 Jun 2016 by Guy Giesa-Wilson
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.7222 0.2585 0.1942 0.7826 0.2266

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

y = Columns 1 through 9 0.4106 0.2487 0.0738 0.9487 0.7577 0.8125 0.2574 0.5969 0.6656 Columns 10 through 18 0.0377 0.1651 0.1910 0.2942 0.1850 0.1701 0.7012 0.3212 0.7173 Columns 19 through 27 0.5945 0.9374 0.4289 0.9424 0.6259 0.3770 0.9974 0.9431 0.3165 Columns 28 through 36 0.3879 0.5369 0.4300 0.9565 0.0389 0.6656 0.8860 0.5271 0.7132 Columns 37 through 45 0.1809 0.9638 0.5345 0.5438 0.3963 0.6189 0.5834 0.2376 0.6154 Columns 46 through 50 0.6295 0.1787 0.3536 0.5867 0.1248

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