Cody

# Problem 6. Select every other element of a vector

Solution 1914799

Submitted on 28 Aug 2019 by Natasha Evans
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.9287 0.4311 0.0488 0.9009 0.1061

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.2680 0.2983 0.1521 0.3751 0.3870 0.0875 0.1304 0.1932 0.6468 0.1788 0.3761 0.5563 0.9478 0.2514 0.0156 0.7162 0.0108 0.4354 Columns 19 through 36 0.4324 0.3954 0.0793 0.6570 0.1507 0.2914 0.3735 0.0845 0.9853 0.8708 0.5380 0.5614 0.7833 0.5499 0.4795 0.7390 0.0108 0.3348 Columns 37 through 50 0.2059 0.7066 0.1946 0.4168 0.1443 0.2952 0.3568 0.0038 0.0882 0.6816 0.7726 0.2876 0.3535 0.4857

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'