Clear Filters
Clear Filters

indexing, How to index into a cell with vector contining zeros/ Nan

3 views (last 30 days)
Hello,
How to index into a cell with vector contining zeros/ Nan? %Array indices must be positive integers or logical values.
How can i find data for the same country that have two differnt names? like USA and united states
for the attached data, i need to calculate:
percent_pv = IRENA_world_solar * 100 / UN_Total_MW; for each same country in the same year.
percent_wind = IRENA_world_wind * 100 / UN_Total_MW; for each same country in the same year.
[A, Locb]= ismember (IRENA_countries, UN_Total_MW_countries) %nnz(A)
[Ar, ia] = setdiff(IRENA_countries, UN_Total_MW_countries)
UN_Total_MW2 = UN_Total_MW_countries(Locb)
Thanks for the help! or any Hint.

Accepted Answer

Walter Roberson
Walter Roberson on 31 May 2021
UN_Total_MW2 = UN_Total_MW_countries(Locb(A))

More Answers (0)

Categories

Find more on Structures 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!