Cody

# Problem 6. Select every other element of a vector

Solution 1978785

Submitted on 16 Oct 2019 by Asif Newaz
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.6869 0.7751 0.3647 0.9602 0.8969

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.2427 0.1455 0.6174 0.0036 0.8750 0.3694 0.1871 0.1662 0.2698 0.8568 0.1626 0.6098 0.4782 0.6988 0.3677 0.4591 0.6514 0.1831 Columns 19 through 36 0.8707 0.4061 0.2977 0.0235 0.8026 0.0028 0.1530 0.5431 0.6417 0.3159 0.3972 0.6315 0.5766 0.2778 0.3217 0.5802 0.2474 0.1843 Columns 37 through 50 0.6652 0.1991 0.4902 0.9873 0.3169 0.8337 0.6060 0.9268 0.8523 0.5927 0.4341 0.6283 0.0041 0.8466

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'