Deleting Duplicates from 2 data sets

Hello dear members,
I was wondering, how can I smartly combine 2 data files and then delete values completely which are common like In fact I want to get Data-1-Data-2 this will remove the entries of data file 2 from data file 1.
Data-1
24/25/W3 23.1 56.3
24/25/W4 25.8 56.8
24/25/W5 29.6 57.9
24/25/W6 25.2 58.4
24/25/W7 25.96 55.7
24/25/W8 30 58
and Data-2
24/25/W5 25.8 56.8
24/25/W3 23.1 56.3
24/25/W10 30 58
24/25/W6 25.2 58.4
24/25/W8 30 58
I want an output file which have both data1 and data 2 entries but no dublicates. You can see there are few same values in above example. Thanks

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 8 日

0 投票

data=unique([data_1;data_2],'rows')

3 件のコメント

amberly hadden
amberly hadden 2015 年 7 月 8 日
Thanks Azzi,
But I'm interested to remove data which is present in data-2 from data 1. Unique will still keep one value of data-2 entries.. Lets say I have a = [1 2 3 4 5] b = [1 3 2] I want out put so out = [4 5]
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 8 日
編集済み: Azzi Abdelmalek 2015 年 7 月 8 日
a = [1 2 3 4 5]
b = [1 3 2]
c=setdiff(a,b)
amberly hadden
amberly hadden 2015 年 7 月 8 日
Thanks Azzi, But again I have a text file I just want to remove data from file-1 which is present in file-2. file-1 is composite data. tahnks

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Import and Analysis についてさらに検索

質問済み:

2015 年 7 月 8 日

コメント済み:

2015 年 7 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by