Cody

Solution 2050818

Submitted on 9 Dec 2019 by Abdelrahman Taha
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))

index = 1 3 5 7 9 y = 0.5683 0.9203 0.2398 0.2757 0.1376

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

index = Columns 1 through 30 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 Columns 31 through 50 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 y = Columns 1 through 18 0.9778 0.9579 0.4325 0.6477 0.5153 0.3174 0.8162 0.9796 0.8805 0.9987 0.1193 0.4014 0.3595 0.4750 0.2518 0.7786 0.2290 0.6037 Columns 19 through 36 0.7626 0.1625 0.1653 0.2375 0.3567 0.4685 0.8396 0.1878 0.0536 0.9604 0.5428 0.1617 0.5033 0.7610 0.3105 0.2311 0.3976 0.5332 Columns 37 through 50 0.9562 0.0574 0.9763 0.1702 0.8589 0.1549 0.7435 0.8688 0.9877 0.3027 0.8368 0.7553 0.8811 0.5567

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

index = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 y = 'Aogiegiaaayafrwy'

Suggested Problems

More from this Author95