how to find subsets of a set in matlab? -
i have set of numbers 28 members. example:
a=1:28;
i want divided set 4 parts(each parts includes 7 numbers). how can find subsets? prefer save subsets in 4 matrixes calculate sum of each subset , other math operations.
on implementation, please have at: http://matlabtricks.com/post-9/get-all-subsets-having-a-given-length , author proposed 2 ways implementation.
-- naive way: enumeration subsets of set except empty set, can realized trick of binary decomposition ( see http://matlabtricks.com/post-7/select-all-subsets-of-a-set). counting size of each subsets , select ones fixed size.
-- non-trivial algorithm: requires initial subset fixed size. set, 1 can generate other similar subsets same size permutations.
tell me if have further questions.
cheers
Comments
Post a Comment