sorting an string cell

1 view (last 30 days)
Muhammad
Muhammad on 1 Jun 2021
Commented: Stephen23 on 1 Jun 2021
i have cell whoes 1st column has names of countries and 2nd have population
i want to arrage it alphabetical oder in such a way so that population of counteries donot misplaced
for example
burundi 11890781 donot change means row wise data donot alter
  3 Comments
Stephen23
Stephen23 on 1 Jun 2021
@Muhammad SULAMAN: then you will need to handle the diacritics yourself (e.g. remove them before sorting and then use the sort index to sort the original data).

Sign in to comment.

Accepted Answer

Rik
Rik on 1 Jun 2021
You can use sortrows directly, or use code like this:
[~,order]=sort(population(:,1));
population=population(order);
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!