Comparing two vectors with different dimensions
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
How can you compare two vectors with different number of elements? I am just trying to find the equal elements. Thanks!
0 commentaires
Réponse acceptée
the cyclist
le 14 Juin 2012
Your question is fairly vague, but I have a feeling that either the ismember() command or the intersect() command will help you do what you want.
Plus de réponses (1)
Rohan Kale
le 19 Juin 2012
Let a and b be two arrays(or vectors). L=length(a), M=length(b).Suppose L>M, pad_zero=L-M; now b=[b zeros(1,pad_zero)]; c=a-b; now you can find the indices of the zero elements excluding the last pad_zero elements. These are your desired indices. Hope it helps.
2 commentaires
Voir également
Catégories
En savoir plus sur Matrices and Arrays 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!