MATLAB: Comparing Couple of Cell Array String

cell arraycell arraysMATLAB

Hi, i want to compare a couple of cell array string. In example :
dataset = {
'i', 'love';
'love', 'you';
'you', 'so';
'so', 'much'
}
if i have below data test :
data_test = {'love', 'you'}
then i want to get below result (according dataset) :
'love' 'you'
Else if my data is like below :
data_test = {'love', 'much'}
Then i want to get below result (according dataset) :
'love' 'you'
So, the process is getting first word. Then getting squence of words in dataset that match with first word…
Is that possible?
Thanks in advance.

Best Answer

data = {
'i', 'love';
'love', 'you';
'you', 'so';
'so', 'much'
};
data_test = {'love', 'much'};
out = data(ismember(data(:,1),data_test(1)),:);