Find match between 2 tables of unequal length

18 views (last 30 days)
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!

Accepted Answer

Voss
Voss on 7 Mar 2023
new_table = B(ismember(B.Name,A.Name),:);

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!