필터 지우기
필터 지우기

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 CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by