Remove Duplicates from Cell Array

102 views (last 30 days)
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

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!