Cody

# Problem 6. Select every other element of a vector

Solution 1874680

Submitted on 15 Jul 2019 by Rory Hughes
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.7142 0.8814 0.4610 0.2546 0.3043

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.9760 0.7822 0.2178 0.3675 0.6240 0.6476 0.5653 0.6415 0.7400 0.1934 0.7494 0.8311 0.9895 0.9926 0.6871 0.4886 0.9608 0.4419 Columns 19 through 36 0.9667 0.7835 0.3590 0.6874 0.8654 0.5899 0.8711 0.5782 0.4107 0.7934 0.2108 0.0992 0.6344 0.8981 0.3937 0.9449 0.3308 0.0855 Columns 37 through 50 0.5215 0.8103 0.6846 0.2990 0.2498 0.7514 0.9449 0.9559 0.1574 0.5776 0.9596 0.1827 0.6107 0.0244

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'