finding values common to 3 different single-column matrices
    13 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
basically i have 3 different matrices (A, B, and C). Each one contains different numbers and is of a different length. However, there are numbers common to all 3 of them. I need to be able to create an output that lists all numbers that are common to all 3 matrices.
For example,
A = [2; 5; 7; 9; 13];
B = [5; 13; 17];
C = [1; 2; 3; 5; 10; 13; 15; 16];
Thus, the common numbers in this case are 5 and 13.
Any idea how to compare the three and find these values?
0 Commenti
Risposte (3)
  Sean de Wolski
      
      
 il 19 Mag 2011
        C(ismember(C,A(ismember(A,B))))
1 Commento
  Matt Fig
      
      
 il 19 Mag 2011
				This approach can return repeated values if the elements of the individual vectors aren't unique.
Vedere anche
Categorie
				Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





