Cody

# Problem 6. Select every other element of a vector

Solution 692290

Submitted on 26 Jun 2015 by Francisco Salgado
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.0190 0.8793 0.9970 0.7344 0.1625

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

y = Columns 1 through 9 0.7518 0.2990 0.8374 0.9986 0.2076 0.2905 0.3363 0.7991 0.4768 Columns 10 through 18 0.2335 0.5305 0.3830 0.3224 0.7962 0.6406 0.6218 0.9271 0.4431 Columns 19 through 27 0.6075 0.9586 0.0750 0.9878 0.8624 0.7850 0.5631 0.4776 0.9957 Columns 28 through 36 0.2326 0.3497 0.4713 0.9949 0.3661 0.5454 0.9549 0.8010 0.3435 Columns 37 through 45 0.3904 0.5635 0.3441 0.5385 0.8161 0.1494 0.8450 0.3248 0.8330 Columns 46 through 50 0.2315 0.1129 0.0763 0.1742 0.7284

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