why ismember() does not return correct result
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Stavros Tsimpoukis
le 10 Oct 2023
Commenté : Dyuman Joshi
le 11 Oct 2023
Hello, I have an original matrix M ( Nx3 ) and another one mat ( Kx3 ). I want to have access to the indicies of rows of the original matrix, M, where the rows of the matrix mat also exist in matrix M. My code is:
idx = find(ismember(M, mat, "rows"))
While most of the rows of mat are correctly returned some rows do not. The common theme is that all of them have the third element equal (1.6).
The array mat:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1507664/image.png)
Rows of array M: ( the row [-2.5 1.65 1.6] exists in the array ! )
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1507669/image.png)
Is this a floating point problem ?
Thanks
Réponse acceptée
Star Strider
le 10 Oct 2023
They may have very small values that are not shown, especially if they are calculated.
0 commentaires
Plus de réponses (0)
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!