Cody

Problem 2488. Create all combinations of vectors

Solution 2112485

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

Error in solution: Line: 31 Column: 1 The function "copyb" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

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

Error in solution: Line: 31 Column: 1 The function "copyb" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

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

Error in solution: Line: 31 Column: 1 The function "copyb" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

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

Error in solution: Line: 31 Column: 1 The function "copyb" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

Suggested Problems

More from this Author21

Community Treasure Hunt

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

Start Hunting!