Find location of exact string

1 view (last 30 days)
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 Comment
the cyclist
the cyclist on 16 Mar 2021
Can you upload your data, or a representative sample, for testing?

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 16 Mar 2021
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 Comment
Tejashree Pawar
Tejashree Pawar on 16 Mar 2021
That helped! Thanks for the reply!

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!

Translated by