If statement or strcmp to compare names.

3 ビュー (過去 30 日間)
LeoAiE
LeoAiE 2021 年 7 月 21 日
コメント済み: LeoAiE 2021 年 7 月 21 日
Hi everyone,
I have two excel sheets, the first one has three columns names, score and extra activities. The second column has only one column with names.
I want to compare the two sheets and if the names matches then I want to add 10 points to the score. I would really appreciate any help. I uploaded the data and below is my code so far.
Data = readtable("Data.xlsx")
Data2 = readtable("Data2.xlsx")
Volunteer_Names = ismember(Data.Extra_activities,'Volunteer Work and Community Service');
Volunteer_Names = Data(Volunteer_Names,:)
Add_Points = strcmp(Data.Names,Data2.Names,:)

採用された回答

Walter Roberson
Walter Roberson 2021 年 7 月 21 日
ismember(). If you only want to know if at least one matches then any() the results; if you want to know how many matched then nnz() the ismember() result
  1 件のコメント
LeoAiE
LeoAiE 2021 年 7 月 21 日
Thanks for the help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by