Discretize countries into regions

3 views (last 30 days)
Amanda Camarata
Amanda Camarata on 9 Feb 2020
Answered: Sagar on 1 Aug 2021
Hello --
I'd like to simplify my data by organizing countries into certain geographical regions. For example, if
countryName == ['Botswana','Eswatini','Lesotho','Namibia','South Africa']
regionName == ('Southern Africa')
and so on. I'd also like to determine the average of these new 'regions' so I can graph them.
Number of countries per new region can vary.
Sample data:
'Algeria' 2001 5.70000000000000 161 24 15 61 39 24 98 'f' 35.4200000000000
'Angola' 2005 0.700000000000000 37 45 34 21 17 13 8 'f' 18.9900000000000
'Benin' 2001 0.130000000000000 14 32 23 45 5 3 6 'f' 9.21000000000000
'Botswana' 2000 0.190000000000000 96 41 18 41 39 17 39 'f' 1.98000000000000
'Burkina Faso' 2001 0.720000000000000 44 39 2 59 17 1 26 'f' 16.2900000000000
'Burundi' 2000 0.290000000000000 34 17 6 77 6 2 26 'f' 8.52000000000000
'Cameroon' 2000 0.970000000000000 49 17 7 76 8 3 37 'f' 19.9600000000000
'Cape Verde' 2000 0.0200000000000000 39 7 2 91 3 1 36 'f' 0.510000000000000
'Central African Republic' 2005 0.0700000000000000 16 83 17 1 13 3 0 'f' 4.51000000000000
... etc.

Answers (2)

Hiro Yoshino
Hiro Yoshino on 10 Feb 2020
One thought would be .... clustering algorithms.
How about using geographical data (longitude and latitude) as an input vector and group them up based on the distance.

Sagar
Sagar on 1 Aug 2021
First download the shapefile of all countries from here:
Then read the shapefile using 'shaperead' and you will see the latitude/longitude range for each countries as well as many other fields. Use those data fields to get what you want.

Community Treasure Hunt

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

Start Hunting!