Borrar filtros
Borrar filtros

find matching indexes

6 visualizaciones (últimos 30 días)
Zied
Zied el 2 de Dic. de 2011
I have two matrices:
A: x rows and 5 columns
B: x rows and 6 columns (the first column contains indexes)
The values of the matrix A are included in the matrix B. I would like to find the indexes of the matrix A (one row)
  2 comentarios
Doug Hull
Doug Hull el 2 de Dic. de 2011
Huh? Please edit the question for clarity.
Chandra Kurniawan
Chandra Kurniawan el 2 de Dic. de 2011
'(the first column contains indexes)' for matrix B or both??

Iniciar sesión para comentar.

Respuesta aceptada

karan
karan el 2 de Dic. de 2011
Index_find = find(ismember(A,B));
  1 comentario
Daniel Shub
Daniel Shub el 2 de Dic. de 2011
Wow, apparently I guessed wrong about the question. Good work Karan.

Iniciar sesión para comentar.

Más respuestas (1)

Daniel Shub
Daniel Shub el 2 de Dic. de 2011
I think you want something like
[x, ia, ib] = intersect(A, B(:, 2:end), 'rows');
B(1, ib)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by