Cody

# Problem 2488. Create all combinations of vectors

Solution 511342

Submitted on 10 Oct 2014 by James
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
%% 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));

2   Pass
%% 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));

3   Pass
%% 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

4   Pass
%% 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

### Community Treasure Hunt

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

Start Hunting!