Unique Function based on 2 columns [Instead of rows]
Afficher commentaires plus anciens
Suppose, I have a cell array, a, with contents as such:
a{1}=[1 3 4 5;
3 3 4 5;
5 5 4 5
2 4 2 6;
6 5 2 6
7 2 3 1;]
How can I apply the 'unique' function on 2 columns [column 3 and 4] such that they will return the value '3' and '2'. [Since there are 3 duplicates for the pair 4,5 and 2 duplicates for the pair 2,6.]
Any hint is greatly appreciated.
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 7 Avr 2013
Modifié(e) : Azzi Abdelmalek
le 7 Avr 2013
b=a{1};
out=all(~(any(diff(b(:,3:4)))))
1 commentaire
RDG
le 8 Avr 2013
Catégories
En savoir plus sur Startup and Shutdown 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!