compare and find index of matching elements of two matrices

2 visualizaciones (últimos 30 días)
sindhura c
sindhura c el 21 de Sept. de 2018
Respondida: KSSV el 21 de Sept. de 2018
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 comentario
KALYAN ACHARJYA
KALYAN ACHARJYA el 21 de Sept. de 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];

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 21 de Sept. de 2018
Read about the function ismember.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by