Remove Duplicate Rows in a Cell Array
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nicholas
am 19 Nov. 2012
Kommentiert: Michael Boateng
am 16 Feb. 2021
Hello,
I'm trying to remove duplicate rows in a cell array. I'm familiar with the 'unique' function for use on vectors (or individual columns of a cell array) but I'm stumped on how to work on the whole array at once.
What I'm looking for is the same as the Excel button "Remove Duplicates" which does this:
withduplicates={
'Bear' 'Chicago' '1 yr'
'Bear' 'Chicago' '1 yr'
'Bear' 'Chicago' '1 yr'
'Bear' 'Miami' '2 yr'
'Bear' 'Miami' '2 yr'
'Lion' 'Denver' '1 yr'
'Lion' 'Miami' '2 yr'
'Lion' 'Miami' '2 yr'
'Lion' 'Miami' '2 yr'
'Tiger' 'Denver' '1 yr'
'Tiger' 'Chicago' '1 yr'
'Tiger' 'Chicago' '1 yr'}
withoutduplicates={
'Bear' 'Chicago' '1 yr'
'Bear' 'Miami' '2 yr'
'Lion' 'Denver' '1 yr'
'Lion' 'Miami' '2 yr'
'Tiger' 'Denver' '1 yr'
'Tiger' 'Chicago' '1 yr'}
Any help is greatly appreciated.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cell Arrays 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!