compare and find index of matching elements of two matrices

2 visualizzazioni (ultimi 30 giorni)
I have two matrices say A=[2.4 2.4] and B=[ 2.4 2.6 3.7 2.4; 3 2.4 4.1 3.6] each element of A compared with each row of B.If the element of A is present in the matrix B, then the index of the element in B should be returned.
In more detail, suppose the first element of A i.e., 2.4 is compared with the first row of B. As it is present in B, the index of the element 2.4 in the B matrix is returned.
  1 Commento
KALYAN ACHARJYA
KALYAN ACHARJYA il 21 Set 2018
Suppose for the following case, what result you are expecting?
A=[1 2 3 4];
B=[1 2 3 4;5 6 7 8;9 3 11 12];

Accedi per commentare.

Risposte (1)

KSSV
KSSV il 21 Set 2018
Read about the function ismember.

Categorie

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

Community Treasure Hunt

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

Start Hunting!

Translated by