problem in find correspond values in two matrixes
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Mani Ahmadian
 le 17 Oct 2014
  
    
    
    
    
    Réponse apportée : Guillaume
      
      
 le 17 Oct 2014
            I have two matrixes, A and B. These are the same size, 7*7.
I checked matrix A for values are between min and max values by this code:
[RowIndex,ColIndex] = find(A>Min & A<=Max);
And then select each correspond member of matrix B by:
temp=B(RowIndex,ColIndex);
But it returns a wrong matrix (for example 20*20).
Please help me to do that.
Thanks a lot.
Mani
0 commentaires
Réponse acceptée
  Guillaume
      
      
 le 17 Oct 2014
        Yes you can't do that.
B([1 5 6 1], [4 3 7 8])
would return a 4x4 matrix consisting of row 1, 5, 6 and 1 again of B and column 4, 3, 7 and 8 of B.
To do what you want, simply use linear indexing:
index = find(A>Min & A<=Max);
temp = B(index);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
