Find match between 2 tables of unequal length

18 次查看(过去 30 天)
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!

采纳的回答

Voss
Voss 2023-3-7
new_table = B(ismember(B.Name,A.Name),:);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by