find data with same name

6 views (last 30 days)
John fredson
John fredson on 20 May 2022
Commented: KSSV on 20 May 2022
For this two data file, I need to plot population of each country in population file with correspond death in owid data file , but they are difference in size, how can I do it?
Ilya Dikariev
Ilya Dikariev on 20 May 2022
You don't need Matlab to do it, it is much easier with excel itself. However, if you want to do it in matlab so strongly then small hint: you can use unique and sum, and extract that column. Or first create new table with filter+pivot table in excel so you can get the total number of death per country and use it in Matlab plot

Sign in to comment.

Accepted Answer

KSSV on 20 May 2022
You can get the deaths of each country using:
T1 = readtable('') ;
T2 = readtable('') ;
[m,n] = size(T2) ;
C = T2.Location ; % countries
P = T2.Population_million_ ; % population
D = zeros(m,1) ; % deaths in each country
for i = 1:m
idx = strcmp(T1.Location,T2.Location{i}) ;
D(i) = sum(T1{idx,7}) ;
Now you can plot what you want.
KSSV on 20 May 2022
REad about format

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!