Cody

# Problem 6. Select every other element of a vector

Solution 1854309

Submitted on 20 Jun 2019 by Vadim Smirnov
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.5895 0.9436 0.4170 0.7595 0.0815

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.3453 0.4415 0.3028 0.1330 0.1810 0.3302 0.2162 0.8222 0.7095 0.0576 0.3623 0.8679 0.0452 0.9602 0.2057 0.6926 0.9468 0.7821 Columns 19 through 36 0.4544 0.4853 0.4896 0.9899 0.4415 0.6827 0.8480 0.1435 0.9012 0.1980 0.8658 0.6283 0.8083 0.2229 0.6324 0.8430 0.9296 0.9562 Columns 37 through 50 0.6804 0.6342 0.0996 0.9537 0.1522 0.6375 0.0008 0.5307 0.8686 0.8383 0.6521 0.1916 0.9031 0.3764

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'