Cody

# Problem 6. Select every other element of a vector

Solution 1907620

Submitted on 21 Aug 2019 by Zoe Ashford
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.2960 0.4883 0.9244 0.7599 0.5854

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.9524 0.8095 0.0263 0.3557 0.4721 0.6663 0.0214 0.1460 0.5061 0.3638 0.5901 0.1152 0.0544 0.7321 0.1113 0.5379 0.3926 0.9087 Columns 19 through 36 0.1500 0.2731 0.6062 0.1174 0.6931 0.1686 0.2631 0.0918 0.3120 0.5691 0.8818 0.6043 0.3270 0.8335 0.2848 0.3299 0.4780 0.0100 Columns 37 through 50 0.9146 0.0043 0.0207 0.9889 0.5840 0.5981 0.4700 0.9458 0.3028 0.2014 0.0484 0.1971 0.4734 0.2694

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'