Cody

# Problem 6. Select every other element of a vector

Solution 2131289

Submitted on 17 Feb 2020 by Charles Nix
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))

0.5637 0.7007 0.5890 0.0753 0.6373

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

0.4854 0.3839 0.7637 0.7172 0.4120 0.6287 0.8152 0.7010 0.1790 0.5080 0.2264 0.1220 0.6781 0.3144 0.9726 0.6765 0.9171 0.3315 0.4550 0.6288 0.6094 0.6409 0.3506 0.0653 0.9227 0.1739 0.4806 0.3022 0.3023 0.8915 0.5058 0.6742 0.8518 0.1003 0.6116 0.3919 0.8314 0.5454 0.5247 0.1127 0.0979 0.9264 0.0899 0.6957 0.5974 0.2794 0.6899 0.6981 0.3082 0.1257

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

A o g i e g i a a a y a f r w y