Deleting duplicate values in matrix
1 回表示 (過去 30 日間)
古いコメントを表示
I have a dataset in which i have duplicate vaues(same values),i want to delete it as
S={
'' 'c1' 'c2' 'c3'
'p-a' 'pso' 'mpso' 'pso'
'p-a' 'pso' 'mpso' 'pso'
'p-a' 'pso' 'mpso' 'pso'
'k' 'spsp' 'pso' 'mpso'
'y-b' 'pso' 'pso' 'spso'
'y-b' 'pso' 'pso' 'spso'}
i need output as
out={
'p-a' 'pso' 'mpso' 'pso'
'k' 'spsp' 'pso' 'mpso'
'y-b' 'pso' 'pso' 'spso'}
please help
採用された回答
Oleg Komarov
2012 年 8 月 27 日
[trash,idx] = unique(S(:,1),'stable');
S(idx,:)
Note that only the first column is considered to be the key.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!