Find match between 2 tables of unequal length

18 visualizaciones (últimos 30 días)
Yen Huynh
Yen Huynh el 7 de Mzo. de 2023
Comentada: Voss el 9 de Mzo. de 2023
Hello everyone, I have two tables and I have simplified my data here:
table A with two columns:
Name Occurences
A 3
B 4
C 5
and table B with several columns:
Name Cell line Bliss
A X 0.23
A Y 0.34
A Z 0.09
B X 0.01
B Y 0.009
B Z 0.07
B T 0.02
C X 0.5
C Y 0.4
C Z 0.2
C T 0.1
C W 0.34
D X 0.1
How can I make a new table to pull out all the data in table B that matches table A? Apparently I don't want "D" in the "Name" colummn of table B to be in my result dataset. I want something that look like this (it should look almost similar to table B, but without "D", because "D" is not a match between table A and table B
Name Cell line Bliss
A X 0.23
A Y 0.34
A Z 0.09
B X 0.01
B Y 0.009
B Z 0.07
B T 0.02
C X 0.5
C Y 0.4
C Z 0.2
C T 0.1
C W 0.34
I am very new to matlab, thank you for your help!

Respuesta aceptada

Voss
Voss el 7 de Mzo. de 2023
new_table = B(ismember(B.Name,A.Name),:);
  2 comentarios
Yen Huynh
Yen Huynh el 9 de Mzo. de 2023
thank you so much!
Voss
Voss el 9 de Mzo. de 2023
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by