Remove Duplicates from Cell Array

37 Ansichten (letzte 30 Tage)
Ammar Taha
Ammar Taha am 21 Nov. 2020
Kommentiert: Ammar Taha am 21 Nov. 2020
Hello there, if I have a cell array as following:
in which the first column is constructed of type 'char' for each element, how can I extract this first col. without duplicates?
Thanks in Advance

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 21 Nov. 2020
You can use unique()
C; % your cell array
country_names = unique(C(:,1))
  1 Kommentar
Ammar Taha
Ammar Taha am 21 Nov. 2020
Thanks a lot, I was confused using unique for the first time.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by