Cody

# Problem 42502. Combine Data With Gaps

Solution 1940605

Submitted on 18 Sep 2019 by Augusto Mazzei
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
a = [1,0; 2,1; 3,5; 5,2; 6,3]; b = [1,2; 3,6; 4,3; 6,4] d_correct = [1,0,2; 2,1,0; 3,5,6; 4,0,3; 5,2,0; 6,3,4]; assert(isequal(comb_gap(a,b),d_correct))

b = 1 2 3 6 4 3 6 4 1 0 2 2 1 0 3 5 6 4 0 3 5 2 0 6 3 4

2   Pass
a = []; b = []; d_correct = []; assert(isequal(comb_gap(a,b),d_correct))

3   Pass
a = []; b = [1,2; 4,8; 7,2]; d_correct = [1,2; 4,8; 7,2]; assert(isequal(comb_gap(a,b),d_correct))

d = 1 2 4 8 7 2 1 2 4 8 7 2

4   Pass
a = [0.5183,0.2425; 0.7750,0.3880; 0.9400,0.3395; 1.5800,0.5335; 2.5467,0.2425]; b = [0.5183,0.2568; 0.9400,0.3492; 1.1383,0.3395; 2.1200,0.3395; 2.5467,0.2315]; d_correct = [0.5183,0.2425,0.2568; 0.7750,0.3880,0 ; 0.9400,0.3395,0.3492; 1.1383,0 ,0.3395; 1.5800,0.5335,0 ; 2.1200,0 ,0.3395; 2.5467,0.2425,0.2315]; assert(isequal(comb_gap(a,b),d_correct))

0.5183 0.2425 0.2568 0.7750 0.3880 0 0.9400 0.3395 0.3492 1.1383 0 0.3395 1.5800 0.5335 0 2.1200 0 0.3395 2.5467 0.2425 0.2315

5   Pass
a = [0 ,0 ; 0.5183,0.2425; 0.7750,0.3880; 0.9400,0.3395; 1.5800,0.5335; 2.5467,0.2425]; b = [0 , 0 ; 0.7117,-0.6794; 0.8650,-0.4854; 1.2550,-0.5824; 1.3317,-0.6309; 1.4467,-0.5824; 1.7050,-0.6309; 1.7717,-0.6794]; d_correct = [0 ,0 , 0 ; 0.5183,0.2425, 0 ; 0.7117,0 ,-0.6794; 0.7750,0.3880, 0 ; 0.8650,0 ,-0.4854; 0.9400,0.3395, 0 ; 1.2550,0 ,-0.5824; 1.3317,0 ,-0.6309; 1.4467,0 ,-0.5824; 1.5800,0.5335, 0 ; 1.7050,0 ,-0.6309; 1.7717,0 ,-0.6794; 2.5467,0.2425, 0 ]; assert(isequal(comb_gap(a,b),d_correct))

0 0 0 0.5183 0.2425 0 0.7117 0 -0.6794 0.7750 0.3880 0 0.8650 0 -0.4854 0.9400 0.3395 0 1.2550 0 -0.5824 1.3317 0 -0.6309 1.4467 0 -0.5824 1.5800 0.5335 0 1.7050 0 -0.6309 1.7717 0 -0.6794 2.5467 0.2425 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!