Cody

# Problem 6. Select every other element of a vector

Solution 1757654

Submitted on 22 Mar 2019 by zo lin
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.3378 0.1488 0.5429 0.5014 0.4407 ans = []

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.8472 0.1509 0.7546 0.2178 0.2969 0.3173 0.5397 0.3872 0.3569 0.2273 0.0750 0.2497 0.9713 0.5011 0.9780 0.3975 0.6932 Columns 18 through 34 0.6721 0.5341 0.7149 0.6278 0.3576 0.6006 0.8046 0.3202 0.2561 0.6418 0.2253 0.8327 0.8483 0.0709 0.0321 0.0030 0.7894 Columns 35 through 50 0.6280 0.7681 0.8420 0.7311 0.6260 0.5431 0.2931 0.6027 0.5377 0.3175 0.4365 0.7996 0.7096 0.5097 0.3694 0.6908 ans = []

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' ans = []