Cody

# Problem 6. Select every other element of a vector

Solution 1495118

Submitted on 17 Apr 2018 by Maruf Ahamed
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.3493 0.2373 0.3885 0.2393 0.8832

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.5470 0.0396 0.0453 0.0161 0.4179 0.2188 0.0448 0.0298 0.4987 0.6922 0.7637 0.9712 0.3196 0.1338 0.2810 0.3112 0.7928 0.3349 Columns 19 through 36 0.1506 0.6273 0.1446 0.2893 0.8067 0.8553 0.6646 0.1804 0.4689 0.4385 0.1840 0.3151 0.0287 0.1798 0.6224 0.1383 0.3292 0.2335 Columns 37 through 50 0.0459 0.7332 0.1107 0.3837 0.2057 0.4562 0.1963 0.5014 0.7823 0.0696 0.5075 0.5345 0.1595 0.2527

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'