how to get common elements within a cell array?
Afficher commentaires plus anciens
hey all
If i have following array:
{[1,7];[2,6,1];[7,1,3];[3,5]}
how can I compare each cell in this array with all other cells'values. for example for first cell [1,7] i have to compare it with all other cells and find common values. to compare with [2,6,1] we will get 1, to compare with [7,1,3] we will get [1,7] and with [3,5] we will get an empty cell. Similarly after this we will compare 2nd cell [2,6,1] with all cells in array.
please help
5 commentaires
Jan
le 5 Mar 2018
What is the wanted output for this example?
Tha saliem
le 5 Mar 2018
Greg
le 5 Mar 2018
Did you try intersect? Probably need a loop or cellfun to go with it.
Do the single vectors have unique elements? In other words: Is this possible as input or not:
{[1,7]; [2,6,1,1,6]}
Tha saliem
le 6 Mar 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!