Cody

# Problem 2488. Create all combinations of vectors

Solution 2112492

Submitted on 31 Jan 2020
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   Fail
a1=[1 2 3; 4 5 6]; a2 = [7 8; 9 10]; D =[ 1 2 3 1 2 3 4 5 6 4 5 6 7 7 7 8 8 8 9 9 9 10 10 10]; assert(isequal(combina(a1,a2),D));

Unrecognized function or variable 'total'. Error in combina (line 8) D= [copyb(total,size(cur,2)); copyi(cur,size(total,2))]; Error in Test1 (line 10) assert(isequal(combina(a1,a2),D));

2   Fail
a1=[1 2 3; 4 5 6]; a2 = [7 8; 9 10]; a3=[2 3 4;4 5 6]; D =[ 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 4 5 6 4 5 6 4 5 6 4 5 6 4 5 6 4 5 6 7 7 7 8 8 8 7 7 7 8 8 8 7 7 7 8 8 8 9 9 9 10 10 10 9 9 9 10 10 10 9 9 9 10 10 10 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6]; assert(isequal(combina(a1,a2,a3),D));

Unrecognized function or variable 'total'. Error in combina (line 8) D= [copyb(total,size(cur,2)); copyi(cur,size(total,2))]; Error in Test2 (line 13) assert(isequal(combina(a1,a2,a3),D));

3   Fail
a1=[1 2 ]; a2 = [7 8]; a3=[2 3 ]; a4=[1 1]; D=[1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 7 7 8 8 7 7 8 8 7 7 8 8 7 7 8 8 2 2 2 2 3 3 3 3 2 2 2 2 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] assert(isequal(combina(a1,a2,a3,a4),D));

D = 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 7 7 8 8 7 7 8 8 7 7 8 8 7 7 8 8 2 2 2 2 3 3 3 3 2 2 2 2 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Unrecognized function or variable 'total'. Error in combina (line 8) D= [copyb(total,size(cur,2)); copyi(cur,size(total,2))]; Error in Test3 (line 10) assert(isequal(combina(a1,a2,a3,a4),D));

4   Fail
a1=[1 2 ]; a2 = [7 ]; a3=[2 ]; a4=[1 ] D=[1 2 7 7 2 2 1 1]; assert(isequal(combina(a1,a2,a3,a4),D));

a4 = 1

Unrecognized function or variable 'total'. Error in combina (line 8) D= [copyb(total,size(cur,2)); copyi(cur,size(total,2))]; Error in Test4 (line 10) assert(isequal(combina(a1,a2,a3,a4),D));

### Community Treasure Hunt

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

Start Hunting!