Given a set S=[a,b,c,v,f,d,e]
, we want to enumerate each possible non-empty subsets. Clearly there will be 2^7-1
such subsets. There ia a way of computing the subsets explicitly like this:-
One could map the above set S
to a 7-bit string and then compute all possible 7-bit strings using the pseudo code above implemented in matlab. Each will correspond to a desired subset except the first one. Above pic is from lec. slides of Computer Science 226: Algorithms and Data Structures for Spring 2011.
I am looking for a MATLAB command that does this automatically. Otherwise what is the easiest way to enumerate all non-empty subsets in matlab with least coding required?