As per Stephen's answer do not use numbered variables. As all your vectors are the same size, you could all store them as rows of a single matrix. If you don't like that, you could store the vectors as elements of a cell array.

V{1} = [2;4;2;1];

V{2} = [3;3;5;1];

V{3} = [4;1;2;1];

V{4} = [7;8;1;1];

V{5} = [5;4;2;1];

V{6} = [1;8;7;1];

V{7} = [3;2;0;1];

V{8} = [9;8;1;1];

V{9} = [1;4;7;1];

V{10} = [2;1;5;1];

Once you've got your vectors in a cell or matrix, it's easy to generate all possible combinations of rows/vectors: use nchoosek. vectorcombinations = nchoosek(1:numel(V), 4);

You can then use the indices to create your matrices. You can use a loop iterating over the rows of vectorcombinations, or more advanced techniques such as cellfun:

allmatrices = cellfun(@(c) [V{c}], num2cell(vectorcombinations, 2), 'UniformOutput', false);

The important bit in the line above is just [V{c}], where c is the content of just one row of vectorcombinations. This just concatenates the 4 vectors referred by the indices of that row.

## Best Answer