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

조회 수: 1 (최근 30일)
Housam
Housam 2021년 5월 31일
댓글: Housam 2021년 5월 31일
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.

채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 31일
UN_Total_MW2 = UN_Total_MW_countries(Locb(A))
  댓글 수: 1
Housam
Housam 2021년 5월 31일
thank you for the answer. next time, i will consider it thoroughly before asking :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by