get possible combinations for 3 elements but 5 columns

2 次查看(过去 30 天)
with worker set [1 2 3], i need to get the possible number of allotments we can do for 5 work, that is i need a matrix as below
[1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
1 2 3 1 2
1 2 2 3 3
...
....
..
3 3 3 3 1];
all such combinations.... please can someone help me...

采纳的回答

KSSV
KSSV 2017-3-7
编辑:KSSV 2017-3-7
k = randi(3,1000,5) ;
l = unique(k,'rows') ;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by