Cody

# Problem 6. Select every other element of a vector

Solution 1355786

Submitted on 24 Nov 2017 by Venkatesh Chilapur
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.8138 0.0092 0.8819 0.1921 0.1167

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.2588 0.1588 0.0849 0.7427 0.9415 0.8170 0.5061 0.5473 0.0189 0.4325 0.9286 0.2269 0.4879 0.0872 0.1584 0.2499 0.3200 0.7144 Columns 19 through 36 0.6890 0.4212 0.0686 0.2220 0.3698 0.6681 0.4253 0.6806 0.2207 0.6508 0.2057 0.7794 0.9083 0.8308 0.8595 0.4985 0.5652 0.2990 Columns 37 through 50 0.3106 0.9897 0.8594 0.8236 0.9814 0.1874 0.5431 0.4014 0.3726 0.2353 0.0127 0.1523 0.5266 0.5265

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'