Hi all, I've the following indices: indices = nchoosek ([1:9], 3)
indices =
1 2 3 1 2 4 1 2 5 1 2 6 1 2 7 1 2 8 1 2 9 1 3 4 1 3 5 1 3 6 1 3 7 1 3 8 1 3 9 1 4 5 1 4 6 1 4 7 1 4 8 1 4 9 1 5 6 1 5 7 1 5 8 1 5 9 1 6 7 1 6 8 1 6 9 1 7 8 1 7 9 1 8 9 2 3 4 2 3 5 2 3 6 2 3 7 2 3 8 2 3 9 2 4 5 2 4 6 2 4 7 2 4 8 2 4 9 2 5 6 2 5 7 2 5 8 2 5 9 2 6 7 2 6 8 2 6 9 2 7 8 2 7 9 2 8 9 3 4 5 3 4 6 3 4 7 3 4 8 3 4 9 3 5 6 3 5 7 3 5 8 3 5 9 3 6 7 3 6 8 3 6 9 3 7 8 3 7 9 3 8 9 4 5 6 4 5 7 4 5 8 4 5 9 4 6 7 4 6 8 4 6 9 4 7 8 4 7 9 4 8 9 5 6 7 5 6 8 5 6 9 5 7 8 5 7 9 5 8 9 6 7 8 6 7 9 6 8 9 7 8 9
where each row of the above 84 rows gives a specific value as shown: C1=reshape(C_IA,size(indices,1) ,[])
C1 =
26.5871 - 0.0000i25.3748 + 0.0000i29.1875 - 0.0000i27.8822 - 0.0000i27.9279 - 0.0000i29.8068 - 0.0000i20.1088 + 0.0000i28.9700 + 0.0000i31.4866 - 0.0000i30.7709 - 0.0000i29.1391 - 0.0000i29.5271 - 0.0000i28.7390 - 0.0000i32.2309 - 0.0000i26.0994 - 0.0000i31.6562 - 0.0000i27.2213 + 0.0000i19.1752 + 0.0000i29.0539 + 0.0000i31.9886 + 0.0000i28.7934 + 0.0000i26.9325 + 0.0000i30.8589 + 0.0000i26.5858 + 0.0000i27.5174 + 0.0000i31.3600 + 0.0000i29.4643 - 0.0000i28.1896 - 0.0000i20.4114 + 0.0000i25.9653 - 0.0000i29.2150 - 0.0000i29.3785 + 0.0000i25.1405 - 0.0000i25.2144 - 0.0000i19.9587 - 0.0000i27.7516 + 0.0000i27.5817 + 0.0000i30.9471 - 0.0000i21.9452 + 0.0000i25.7818 - 0.0000i27.0898 - 0.0000i25.6516 + 0.0000i27.9703 - 0.0000i29.8913 - 0.0000i28.7567 + 0.0000i26.5974 - 0.0000i27.8911 + 0.0000i28.2247 + 0.0000i30.4570 - 0.0000i32.3383 - 0.0000i23.6659 - 0.0000i26.0332 - 0.0000i24.4511 - 0.0000i31.6553 - 0.0000i28.5011 + 0.0000i28.2660 - 0.0000i25.6020 - 0.0000i30.5952 + 0.0000i23.9412 + 0.0000i18.3079 - 0.0000i27.3033 + 0.0000i29.0838 + 0.0000i29.8749 - 0.0000i28.0912 + 0.0000i19.2981 + 0.0000i23.3627 - 0.0000i29.4325 - 0.0000i31.1372 - 0.0000i22.5496 - 0.0000i27.3350 - 0.0000i28.2363 + 0.0000i34.0017 + 0.0000i28.1177 - 0.0000i32.8989 + 0.0000i28.2460 - 0.0000i26.2227 - 0.0000i24.6639 - 0.0000i25.9026 + 0.0000i30.5478 - 0.0000i25.5483 - 0.0000i29.4994 - 0.0000i31.3045 + 0.0000i31.9083 - 0.0000i32.6127 - 0.0000i
I would like to generate 3 different group of numbers in one time (where each row represent a number) so that all the three groups has unique (not repeated) numbers. i.e. If the 1st generated group was : 1 2 3 (which has a value of 26.5871 then the 2nd group must be any three numbers from 1 to 9 except 1 2 3 (let's say 2nd generated group was: 4 5 6 which has a value of 19.2981 ) then the 3rd generated group must be any number from 1 to 9 except all previously selected numbers (any 3 numbers except 1,2,3,4,5,6) hence we have 3rd group is: 7 8 9 which has a value of 32.6127 so, the expected result of my example is : 26.5871 19.2981 32.6127
I need to do this for all different cases (and not for only the above case), i.e to generate all possible ways of dividing up the numbers from 1 to 9 into three groups with three numbers in each group. The total number of these is 9!/3!/3!/3! = 1680 different result. (the above Example gives only one result out of those 1680 result that i need)
another 2nd example for clarity, if one combination out of the 1680 combinations was: 7 8 9 4 5 6 1 2 3 then i expect to get C1(84,:) and C1(65,:) and C1(1,:)
any help?
P.S. I've already got the 1680 rows combinations but don't know how to map those to my 84 result of C1
Best Answer