how to delete the duplicated rows (in a specific way)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Amr Hashem
am 16 Mai 2015
Bearbeitet: Andrei Bobrov
am 16 Mai 2015
i have this table (size:8*6 & cells):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150181/image.png)
and i want to delete duplicated rows with saving the 6th column in the original row.
i want the answer to be (table, size(5*8) , cell):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150183/image.jpeg)
i have a larger data this is a sample, I hope that pictures clarify the problem.
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 16 Mai 2015
Bearbeitet: Andrei Bobrov
am 16 Mai 2015
a = [text{:,1}];
m = numel(a);
[~,b1,c1] = unique(a,'first');
n = ones(m,1);
n(b1(2:end)) = 1-diff(b1);
i1 = accumarray([c1, cumsum(n)],(1:m)',[],[],m+1);
txt1 = [text(:,6);{''}];
out = [text(b1,1:5),tx1(i1)];
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!