Say I have a cell array in the following format:
A = {4;[22 16 4]; 23; 51; [16 22]; 32; [4 50]};
I want to output the unique columns gained by any permutations of the vectors in the rows.
For example, for the example in the above, the only column vectors that would satisfy this would be
[4; 22; 23; 51; 16; 32; 50] and [4; 16; 23; 51; 22; 32; 50] .
I can't choose 4 from the second or last rows since 4 is the only option in the first row. Moreover, I can't choose 22 in both the second and fifth rows since this would make the column nonunique. Although empty choices in some rows are not allowed, if there are no unique columns, then I would need to output an empty column.
Does anyone have a smart way of doing this (fairly quickly) in Matlab? Any help would be much appreciated.
Many thanks!
