Cody

# Problem 6. Select every other element of a vector

Solution 2239477

Submitted on 27 Apr 2020 by srisai vangara
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))

rows = 1 col = 10 y = 0.8082 0.1160 0.2339 0.8399 0.0511

2   Pass
x = rand(1,100); actual = everyOther(x); expected = x(1:2:length(x)); assert(isequal(actual, expected))

rows = 1 col = 100 y = Columns 1 through 18 0.9875 0.2046 0.1468 0.1879 0.0018 0.9034 0.6515 0.8726 0.6589 0.4256 0.1372 0.6733 0.3877 0.3864 0.5122 0.5853 0.9489 0.0267 Columns 19 through 36 0.1898 0.7965 0.2872 0.4164 0.9450 0.7967 0.2109 0.2127 0.1056 0.5271 0.1590 0.9205 0.7447 0.3931 0.8647 0.6645 0.1389 0.0776 Columns 37 through 50 0.7021 0.0102 0.5178 0.8714 0.0589 0.5536 0.1414 0.0843 0.4042 0.0231 0.5539 0.2974 0.4885 0.3447

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))

rows = 1 col = 31 y = 'Aogiegiaaayafrwy'