Using or with strfind
16 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have two patterns p1 (or) p2, to be found within a single string, str. The objective is to get the position if either of those two patterns is found. But the following doesn't seem to work:
position=strfind(str,p1 || p2)
How to modify this statement to get the result?
Thanks.
0 件のコメント
回答 (1 件)
KSSV
2021 年 2 月 12 日
position1 = strfind(str,p1) ;
position2 = strfind(str,p2) ;
OR
position = strfind(str,[p1, p2]) ;
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!