Home Unique columns based on cell array
Reply: 0

Unique columns based on cell array

user906 Published in August 15, 2018, 11:16 am

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 non-unique. 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!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.373226 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO