Cody

# Problem 6. Select every other element of a vector

Solution 1798112

Submitted on 26 Apr 2019 by Beatriz Orozco
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.3586 0.9348 0.8695 0.0977 0.1633

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.2835 0.7049 0.4533 0.8183 0.7238 0.7476 0.6316 0.8558 0.8555 0.5445 0.6948 0.7220 0.0839 0.5466 0.9873 0.9775 0.0337 0.3319 Columns 19 through 36 0.8240 0.7782 0.5183 0.8819 0.8122 0.9832 0.3384 0.3045 0.0071 0.9747 0.3312 0.7176 0.9044 0.8833 0.7890 0.5871 0.6392 0.5063 Columns 37 through 50 0.2117 0.2404 0.2939 0.3753 0.9835 0.6364 0.4991 0.7720 0.9362 0.1047 0.7722 0.3976 0.2239 0.7554

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'