Cody

# Problem 6. Select every other element of a vector

Solution 2043080

Submitted on 2 Dec 2019 by Petr Stieber
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.1885 0.1169 0.9529 0.6401 0.4484

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.6131 0.9432 0.5834 0.8803 0.6526 0.8594 0.4687 0.6777 0.0084 0.3503 0.7976 0.2580 0.2587 0.4464 0.3236 0.1150 0.1162 0.5304 Columns 19 through 36 0.3989 0.1983 0.1138 0.7306 0.3084 0.4702 0.1886 0.5860 0.0460 0.3119 0.2112 0.2065 0.9915 0.6711 0.3224 0.0034 0.3158 0.0028 Columns 37 through 50 0.6815 0.7754 0.3067 0.4023 0.6125 0.4427 0.0605 0.4874 0.7067 0.3477 0.5850 0.0636 0.2809 0.6366

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'