Cody

# Problem 6. Select every other element of a vector

Solution 2077335

Submitted on 2 Jan 2020 by kieran saunders
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))

r = 1 c = 10 y = 0.5245 0.6514 0.6922 0.6411 0.2174

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

r = 1 c = 100 y = Columns 1 through 18 0.7929 0.4090 0.2546 0.1239 0.1367 0.5896 0.8348 0.0766 0.3621 0.7138 0.8957 0.5253 0.0130 0.4789 0.3143 0.1717 0.1302 0.3885 Columns 19 through 36 0.7484 0.0888 0.5332 0.3246 0.6659 0.4597 0.0468 0.2952 0.7132 0.8391 0.3720 0.1793 0.3535 0.4962 0.0037 0.1649 0.9946 0.8675 Columns 37 through 50 0.5739 0.3507 0.1257 0.5409 0.4772 0.2374 0.0783 0.3020 0.7145 0.9939 0.0021 0.3357 0.0237 0.7115

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))

r = 1 c = 31 y = 'Aogiegiaaayafrwy'