Filter löschen
Filter löschen

How to match two arrays

2 Ansichten (letzte 30 Tage)
Yro
Yro am 6 Jan. 2021
Beantwortet: KSSV am 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.

Antworten (1)

KSSV
KSSV am 6 Jan. 2021
Read about ismember.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by