Cody

Solution 232023

Submitted on 18 Apr 2013 by Haresh Varu
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))

ans = 0.9390 0.5502 0.5870 0.3012 0.2305

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

ans = Columns 1 through 10 0.1948 0.1707 0.4357 0.9234 0.1848 0.9797 0.1111 0.4087 0.2622 0.7112 Columns 11 through 20 0.1174 0.3188 0.5079 0.2625 0.0292 0.7303 0.5785 0.4588 0.5468 0.2316 Columns 21 through 30 0.6241 0.3955 0.9880 0.8852 0.7962 0.2619 0.6797 0.7212 0.6538 0.7791 Columns 31 through 40 0.9037 0.3342 0.1978 0.7441 0.4799 0.6099 0.8594 0.5767 0.2399 0.0287 Columns 41 through 50 0.1679 0.7127 0.4711 0.6820 0.0714 0.0967 0.8175 0.1499 0.5186 0.6490

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

ans = Aogiegiaaayafrwy