How to find unique combination of values in a cell array?
1 view (last 30 days)
Show older comments
Hi, I have a cell array with a variable number of values inside each cell, something like this:
M=
{1,99,99} {2,99,99}{3,99,99}
{4,99}{5,99}{6,99}
{7,99,99,99,99}{8,99,99,99}{9,99,99,99}
I want to create every possible combination of cell arrays contanining one unique value in each cell, and that value could not been repeated in the other cells, in the case of the example, something like:
m1=
{1}{2}{3}
{4}{5}{6}
{7}{8}{9}
--- (I know there is more possible combinations, but for the sake of space limit, I would use only that example matrix)
Problem is that my cell array is huge, 512x4 and each cell array could contain bewteen 4 and 16 values. I tried to different methods I found here, and one person suggest me use to use allcomb, to generate all possible combination, which works pretty well in most cases, but because my cell array is so big and possible combinations are so many, MATLAB stops and gives messages of arrays exceeding memory. My question is, is there any way to do what I want without overpass memory limit? Thank you so much in advance.
0 Comments
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!