Say I have this matrix of ones and zeros, 10×6:
x= [ 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1];
I would like to remove the columns that are a subset of any other column. For instance, column 2 is a subset of column 3 (because all ones in column 2 are in the same rows of column 3). Similarly column 3 is a subset of column 6, then columns 3 should be eliminated. At the end only the columns are not "subset" of other should remain only. So in the example, I should get:
0 1 00 1 10 0 10 0 00 0 01 0 00 1 10 0 10 0 10 0 1
The order of te columns is not importan, but the speed.
Any hint will be very much appreciatted. Thanks!
Best Answer