Cody

# Problem 6. Select every other element of a vector

Solution 1990374

Submitted on 25 Oct 2019 by Václav Kocar
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.4131 0.9396 0.9333 0.4722 0.2002

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.2577 0.3144 0.6379 0.0534 0.9438 0.0983 0.8063 0.8539 0.6640 0.4644 0.9609 0.7724 0.0387 0.5320 0.7279 0.0548 0.7966 Columns 18 through 34 0.0710 0.5391 0.7839 0.9065 0.4373 0.5844 0.6406 0.1245 0.2226 0.7063 0.8347 0.7116 0.3787 0.7189 0.3770 0.1512 0.7621 Columns 35 through 50 0.1585 0.9809 0.0251 0.2487 0.6325 0.6926 0.6466 0.6833 0.6237 0.3690 0.9231 0.0379 0.1617 0.8124 0.4815 0.4740

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'