Cody

# Problem 6. Select every other element of a vector

Solution 1155084

Submitted on 6 Apr 2017 by Nikoo Azarm
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.4090 0.1165 0.6371 0.7654 0.7852

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.0770 0.6464 0.2361 0.4418 0.6718 0.6752 0.4269 0.2814 0.3011 0.5757 0.7692 0.4418 0.9417 0.7116 0.3018 0.1235 0.7357 Columns 18 through 34 0.4369 0.2226 0.9357 0.7062 0.1655 0.9648 0.9207 0.2040 0.1395 0.4137 0.9804 0.8471 0.0827 0.4070 0.2334 0.1143 0.0537 Columns 35 through 50 0.7170 0.5419 0.5082 0.5405 0.0485 0.3918 0.2907 0.9157 0.5231 0.5122 0.8121 0.0584 0.2817 0.7547 0.8170 0.9380

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'