Here's one way:
x = [1 2 3];
n = 5;
% generate a matrix M whose rows are all possible
% sets of n elements from x:
m = numel(x);
M = x(1+dec2base(0:m^n-1,m)-'0');
% remove rows of M that don't have each element
% of x at least once:
for ii = 1:m
M(~any(M == x(ii),2),:) = [];
end
disp(M)
1 1 1 2 3
1 1 1 3 2
1 1 2 1 3
1 1 2 2 3
1 1 2 3 1
1 1 2 3 2
1 1 2 3 3
1 1 3 1 2
1 1 3 2 1
1 1 3 2 2
1 1 3 2 3
1 1 3 3 2
1 2 1 1 3
1 2 1 2 3
1 2 1 3 1
1 2 1 3 2
1 2 1 3 3
1 2 2 1 3
1 2 2 2 3
1 2 2 3 1
1 2 2 3 2
1 2 2 3 3
1 2 3 1 1
1 2 3 1 2
1 2 3 1 3
1 2 3 2 1
1 2 3 2 2
1 2 3 2 3
1 2 3 3 1
1 2 3 3 2
1 2 3 3 3
1 3 1 1 2
1 3 1 2 1
1 3 1 2 2
1 3 1 2 3
1 3 1 3 2
1 3 2 1 1
1 3 2 1 2
1 3 2 1 3
1 3 2 2 1
1 3 2 2 2
1 3 2 2 3
1 3 2 3 1
1 3 2 3 2
1 3 2 3 3
1 3 3 1 2
1 3 3 2 1
1 3 3 2 2
1 3 3 2 3
1 3 3 3 2
2 1 1 1 3
2 1 1 2 3
2 1 1 3 1
2 1 1 3 2
2 1 1 3 3
2 1 2 1 3
2 1 2 2 3
2 1 2 3 1
2 1 2 3 2
2 1 2 3 3
2 1 3 1 1
2 1 3 1 2
2 1 3 1 3
2 1 3 2 1
2 1 3 2 2
2 1 3 2 3
2 1 3 3 1
2 1 3 3 2
2 1 3 3 3
2 2 1 1 3
2 2 1 2 3
2 2 1 3 1
2 2 1 3 2
2 2 1 3 3
2 2 2 1 3
2 2 2 3 1
2 2 3 1 1
2 2 3 1 2
2 2 3 1 3
2 2 3 2 1
2 2 3 3 1
2 3 1 1 1
2 3 1 1 2
2 3 1 1 3
2 3 1 2 1
2 3 1 2 2
2 3 1 2 3
2 3 1 3 1
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