Clear Filters
Clear Filters

get possible combinations for 3 elements but 5 columns

2 views (last 30 days)
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...

Accepted Answer

KSSV
KSSV on 7 Mar 2017
Edited: KSSV on 7 Mar 2017
k = randi(3,1000,5) ;
l = unique(k,'rows') ;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!