Find Index Positions of a Small Array values in a Global Array

11 vues (au cours des 30 derniers jours)
Nicolas Jalbert
Nicolas Jalbert le 20 Nov 2017
Modifié(e) : KL le 20 Nov 2017
Hi guys,
I have a "global" array: Global = [1; 4; 6; 9; 13; 17; 26; 33; 47].
And a "small" array: Small = [6; 26; 47]
How can I find the positions of the "small" array values into the "Global" array? The result would be: Result = [3 7 9]
Thanks! Nicolas

Réponse acceptée

KL
KL le 20 Nov 2017
Modifié(e) : KL le 20 Nov 2017
G = [1; 4; 6; 9; 13; 17; 26; 33; 47];
S= [6; 26; 47];
find(ismember(G,S))
ans =
3
7
9

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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!

Translated by