Cody

# Problem 6. Select every other element of a vector

Solution 1463791

Submitted on 15 Mar 2018 by Reece Blunt
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.7036 0.3072 0.7991 0.5259 0.8039

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.9363 0.1466 0.4592 0.2362 0.3446 0.4088 0.3217 0.9339 0.3331 0.5702 0.0303 0.2821 0.7852 0.8563 0.5853 0.9135 0.6033 0.4276 Columns 19 through 36 0.5134 0.5678 0.6128 0.1559 0.3235 0.3617 0.9782 0.8019 0.1185 0.6389 0.4262 0.7079 0.8968 0.0072 0.0792 0.4747 0.0056 0.8975 Columns 37 through 50 0.8403 0.4739 0.2877 0.3415 0.8769 0.1847 0.2370 0.4870 0.9870 0.8763 0.5323 0.8242 0.5051 0.3553

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'