How to delete an repeated values in matrix?
古いコメントを表示
I have matrix like this, so how to delete repeated values in this case?
[a b]=[197.9040 11.6502 41.6502 41.3856 41.3856 0 197.9040
12.2180 51.2008 61.2008 104.3122 104.3122 0 12.2180];
採用された回答
その他の回答 (2 件)
Roger Stafford
2015 年 2 月 9 日
If x is your array with repetitions
[~,ia] = unique(x,'first','legacy');
x = x(sort(ia));
Andrei Bobrov
2015 年 2 月 9 日
編集済み: Andrei Bobrov
2015 年 2 月 9 日
x = [197.9040 11.6502 41.6502 41.3856 41.3856 0 197.9040
12.2180 51.2008 61.2008 104.3122 104.3122 0 12.2180];
x = x(:);
[xx,~,c] = unique(x);
b = histc(c,1:max(c));
out = xx(b==1);
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!