Cody

# Problem 6. Select every other element of a vector

Solution 1859101

Submitted on 27 Jun 2019 by kashish sharma
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.9292 0.4094 0.2569 0.5107 0.8477

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.6602 0.2400 0.1750 0.0629 0.0288 0.0344 0.0484 0.7958 0.6918 0.9639 0.9717 0.2386 0.1778 0.4297 0.0189 0.0341 0.7696 0.1119 Columns 19 through 36 0.9521 0.5883 0.5712 0.8217 0.3490 0.8146 0.9246 0.1950 0.6028 0.4496 0.9242 0.1100 0.0003 0.4576 0.4478 0.5971 0.2904 0.1157 Columns 37 through 50 0.6683 0.4797 0.3566 0.6359 0.0979 0.1306 0.1889 0.9118 0.8846 0.3876 0.7560 0.6572 0.7720 0.5779

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'