Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 353401

Submitted on 17 Nov 2013 by J-G van der Toorn

Correct

30Size
Leading solution size is 25.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
assert(isequal(another([1 8 12],[4 5 9]),[1 2 3 4 8 7 6 5 12 11 10 9]))

                    
2
Pass
 
%%
assert(isequal(another([5 5 5],[9 5 1]),[5 6 7 8 9 5 5 4 3 2 1]))

                    
3
Pass
 
%%
assert(isequal(another([100 102],[-1 105]),[100:-1:-1 102 103 104 105]))

                    
4
Pass
 
%%
y=[randi(20) randi([30 40],1,2) randi(3)];
assert(isequal(another(y(1:2:3),y(2:2:4)),[y(1):y(2) y(3):-1:y(4)]))

                    
5
Pass
 
%%
assert(isequal(another([1 2 1 2 2 2 1 1 1],[1 2 1 1 2 1 2 2 1]),[1 2 1 2 1 2 2 1 1 2 1 2 1]))