Effacer les filtres
Effacer les filtres

How to match two arrays

2 vues (au cours des 30 derniers jours)
Yro
Yro le 6 Jan 2021
Réponse apportée : KSSV le 6 Jan 2021
Hi, how can I make the match two following arrays? I want to obtain a 29x1 array with the position of the corresponding match.
Tried the following, performing a cell array for each position but I get what I want.
for i = 1:length(PATTERNS_FOR_ERANOS)
DATA_FROM_DAKOTA1{i} = find(POSICIONES_ERANOS(:,1) == PATTERNS_FOR_ERANOS(i,1));
DATA_FROM_DAKOTA2{i} = find(POSICIONES_ERANOS(:,2) == PATTERNS_FOR_ERANOS(i,2));
end
% 87x2 array
POSITIONS = [ ...
31 29
31 30
30 31
29 31
29 30
30 29
31 28
32 28
32 29
...
];
% 29x2 array
PATTERNS_FOR_ERANOS = [...
26 34
28 34
30 34
32 32
34 30
34 28
34 26
33 27
31 27
29 27
...
];
% 29x1 array
DATA_FROM_DAKOTA = [...
1
2
3
4
4
5
7
8
9
3
2
...
];
Thanks in advance.

Réponses (1)

KSSV
KSSV le 6 Jan 2021
Read about ismember.

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by