How to filter unwanted list from total list

4 views (last 30 days)
Hi,
I have two tables 1. Total list, 2. Unwanted list. Now, I want to filter out the unwanted list from total list. The data is cell array.
Kindly some suggest me how to do this. Many thanks in advance.
Total list:
BG08HYK
VF8Y6K
VP0K86KL
VB180KET
VF07K6G
VA00KE
VF8Y6K
VP0K86KL
VB180KET
VF78KE9K
VP0K166KU
VB180KET
VF89K6G
VA00KE9K
Unwanted List:
VF07K6G
VF8Y6K
VF78KE9K
VB180KET

Accepted Answer

Walter Roberson
Walter Roberson on 21 May 2016
setdiff(TotalList, UnwantedList)
  3 Comments
Mekala balaji
Mekala balaji on 21 May 2016
Edited: Walter Roberson on 21 May 2016
Sir, one more help, I have below total list, if a particular row either column one or column2 belongs to unwanted list, and then remove total row. Sir, ( I also want the row index).
BG08HYK VP0K86KL
VF8Y6K VB180KET
VP0K86K LVF07K6G
VB180KET VA00KE
VF07K6G VF8Y6K
VA00KE VP0K86KL
VF8Y6K VB180KET
VP0K86KL VF78KE9K
VB180KET BG08HYK
VF78KE9K VF8Y6K
VP0K166KU VP0K86KL
VB180KET VB180KET
VF89K6G VF8Y6K
VA00KE9K VP0K86KL
Walter Roberson
Walter Roberson on 21 May 2016
mask = any(ismember(TotalList, unwantedList),2);
row_index_to_remove = find(mask);
TotalList(mask,:) = [];

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!