Cody

# Problem 6. Select every other element of a vector

Solution 1816560

Submitted on 15 May 2019 by Christopher Wible
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.1016 0.7137 0.1913 0.0374 0.8894

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.6036 0.3879 0.9658 0.2568 0.6575 0.0366 0.6299 0.0357 0.2125 0.8011 0.8279 0.3896 0.4272 0.0304 0.5920 0.3262 0.0277 0.7783 Columns 19 through 36 0.8546 0.8699 0.5244 0.3457 0.6702 0.4824 0.1277 0.6218 0.3815 0.7530 0.2725 0.3293 0.7135 0.5990 0.8831 0.6477 0.9956 0.1717 Columns 37 through 50 0.8003 0.3226 0.3074 0.8203 0.0571 0.9775 0.3881 0.1566 0.0258 0.7474 0.4954 0.5247 0.9042 0.7089

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'