Search For String within String

I have a large set of dates and times in a string array and I need to search for a smaller string of dates and times within the large set. I have tried using strfind and strcmp but can't seem to manage it.
It's also possible that the dates and times won't match up perfectly (they may differ by some number of seconds, I will figure out a suitable time when necessary), so is it then also possible to use a conditional statement on a string so that I can do the search?

5 件のコメント

Bob Thompson
Bob Thompson 2019 年 5 月 20 日
Do you know how to use regexp?
KSSV
KSSV 2019 年 5 月 21 日
Read about ismemebr, ismemebrtol. These are the function which will help you.
Dean Kennedy
Dean Kennedy 2019 年 5 月 21 日
From what I can see, regexp requires you to know the expression you want beforehand and you can't use a string array (?) to search within the larger string.
ismembertol looks promising but again I'm not sure it can be used on a string array. Would a datetime array work?
Stephen23
Stephen23 2019 年 5 月 21 日
"I have a large set of dates and times in a string array ..."
This is what I found in the uploaded files (opened using R2015b):
>> FileTimes
FileTimes =
""
>> SDT
SDT =
""
>>
Dean Kennedy
Dean Kennedy 2019 年 5 月 21 日
That's strange, here's the whole workspace (if that helps). Files in question are 'SDT' (large set of dates) and 'FileTimes' (small set).

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R2018a

質問済み:

2019 年 5 月 20 日

コメント済み:

2019 年 5 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by