Azzera filtri
Azzera filtri

How to match two arrays

2 visualizzazioni (ultimi 30 giorni)
Yro
Yro il 6 Gen 2021
Risposto: KSSV il 6 Gen 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.

Risposte (1)

KSSV
KSSV il 6 Gen 2021
Read about ismember.

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by