Comment detail

全ての組み合わせ (Nested Flatten)
とりあえず御言葉に甘えて数字のみ対応。
1
2
3
4
5
6
7
8
9
function c = multisetcomb(varargin)
% return all combinations of items in given column vectors by picking up one
% item from each at once.
s1 = varargin{1};
s2 = varargin{2};
c = [repmat(s1,size(s2,1),1) sortrows(repmat(s2,size(s1,1),1))];
if length(varargin) > 2
    c = multisetcomb(c,varargin{3:end});
end

Index

Feed

Other

Link

Pathtraq

loading...