其他行 b>中重复,它们在给定矩阵中重复的次数。为了使它更好一点,你只需要到重复在租赁两次或更多显示行/数字。示例是显示该做什么的最佳方法: p> %p是给定的矩阵p = [1 2 3 4 5;2 3 4 5 1;3 4 6 7 8;1 2 4 3 5;4 6 3 2 1];%v是被检查的每行的元素量,以查看它们是否在另一行v = 4中重复; %Output: out =
1 2 3 4 4 1 2 3 5 3 1 2 4 5 3 1 3 4 5 3 2 3 4 5 3 %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.
So more examples...
p = [1 2 3 4 9; 2 3 1 4 8] v = 4;
out = 1 2 3 4 2 %so any combination of 1,2,3 and 4 appear 2 times in matrix p
and another:
p = [1 2 3 4 9; 2 3 1 4 8; 3 4 2 7 1] v = 3;
out = 1 2 3 3 1 2 4 3 1 3 4 3 2 3 4 3 %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found
last example:
p = [1 2 3 4 9; 2 3 1 4 8] v = 2;
out = 1 2 2 1 3 2 1 4 2 2 3 2 2 4 2 3 4 2 %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.