Cody

# Problem 6. Select every other element of a vector

Solution 1246257

Submitted on 4 Aug 2017 by Matthew Luerman
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.8071 0.3927 0.2059 0.2792 0.1173

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.7065 0.1171 0.6413 0.5438 0.2056 0.9179 0.1193 0.9270 0.1920 0.5405 0.0469 0.5694 0.0178 0.3933 0.7491 0.8228 0.1752 Columns 18 through 34 0.2184 0.2152 0.8866 0.3450 0.8482 0.5393 0.1669 0.8017 0.0193 0.3274 0.7039 0.1681 0.8916 0.9169 0.0760 0.4991 0.0981 Columns 35 through 50 0.2280 0.4402 0.7717 0.2289 0.9312 0.1112 0.6159 0.8141 0.4221 0.7769 0.9444 0.6633 0.8261 0.0887 0.2700 0.7085

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'