Cody

# Problem 6. Select every other element of a vector

Solution 2025175

Submitted on 17 Nov 2019 by Vaibhav Shende
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.3781 0.9225 0.8262 0.6343 0.2529

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.3622 0.4876 0.0308 0.0631 0.9948 0.3748 0.5466 0.0604 0.9066 0.9601 0.0004 0.6902 0.9842 0.1932 0.4805 0.4156 0.9971 0.5748 Columns 19 through 36 0.7751 0.0068 0.5906 0.5210 0.2780 0.3619 0.7321 0.6552 0.1031 0.4020 0.5911 0.1102 0.7596 0.2562 0.6495 0.2261 0.0982 0.6721 Columns 37 through 50 0.5452 0.2288 0.6879 0.0657 0.5023 0.5902 0.4781 0.3296 0.4916 0.0983 0.9633 0.9400 0.6290 0.1434

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'