Cody

# Problem 6. Select every other element of a vector

Solution 2100513

Submitted on 21 Jan 2020 by Abhinav Dubey
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))

yodd = 0.9073 0.7970 0.3704 0.6489 0.3359

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

yodd = Columns 1 through 17 0.3561 0.8010 0.2273 0.1157 0.5678 0.6822 0.8128 0.2073 0.0138 0.4797 0.6530 0.4938 0.2257 0.0820 0.1352 0.2711 0.2385 Columns 18 through 34 0.9718 0.6770 0.2226 0.2223 0.4705 0.4659 0.8252 0.9065 0.6198 0.2732 0.6046 0.7042 0.1856 0.7920 0.3373 0.6331 0.5047 Columns 35 through 50 0.2152 0.6013 0.0309 0.7384 0.6353 0.4793 0.8195 0.1508 0.5010 0.5695 0.1370 0.1849 0.2071 0.6879 0.0891 0.4574

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

yodd = 'Aogiegiaaayafrwy'