Find function in arrays
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am having two matrix. Selected elements in one matrix is present as elements in another matrix. Now i need to find the position of selected elements in the original matrix.
for example
yenidendonguyegirecekler =
-1321.6
-2119.8
-2825.5
-2937.5
-3205.4
-3340.9
-3895.0
-4080.2
-4320.9
fitnesshafiza =
-4080.2
-2937.5
-2825.5
-5749.6
-3205.4
-2119.8
-3340.9
-4320.9
-3895.0
-1321.6
0 commentaires
Réponse acceptée
Voss
le 14 Mai 2022
yenidendonguyegirecekler = [
-1321.6
-2119.8
-2825.5
-2937.5
-3205.4
-3340.9
-3895.0
-4080.2
-4320.9];
fitnesshafiza = [
-4080.2
-2937.5
-2825.5
-5749.6
-3205.4
-2119.8
-3340.9
-4320.9
-3895.0
-1321.6];
To find where the elements of yenidendonguyegirecekler are located in fitnesshafiza:
[~,idx] = ismember(yenidendonguyegirecekler,fitnesshafiza)
2 commentaires
Plus de réponses (1)
the cyclist
le 14 Mai 2022
You can use the ismember function to find out whether each element of one vector is present in the other, and also the location.
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!