フィルターのクリア

Find location of exact string

1 回表示 (過去 30 日間)
Tejashree Pawar
Tejashree Pawar 2021 年 3 月 16 日
コメント済み: Tejashree Pawar 2021 年 3 月 16 日
Using this line fo code to find "sin 1 offset" in my xml file which also contains "sin 1 offset correction" and the code returns locaion for both instead of just for "sin 1 offset".
How do i return location of the exact string?
My code:
row_idx_Sin1Off = find(~cellfun('isempty',regexp(data,'\<Sin 1 Offset\>')))+1;
  1 件のコメント
the cyclist
the cyclist 2021 年 3 月 16 日
Can you upload your data, or a representative sample, for testing?

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

採用された回答

the cyclist
the cyclist 2021 年 3 月 16 日
Adapting your code, maybe something like this?
yes = find(~cellfun('isempty',regexp(data,'\<Sin 1 Offset\>')))+1;
no = find(~cellfun('isempty',regexp(data,'\<Sin 1 Offset Correction\>')))+1;
row_idx_Sin1Off = setxor(yes,no)
  1 件のコメント
Tejashree Pawar
Tejashree Pawar 2021 年 3 月 16 日
That helped! Thanks for the reply!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by