フィルターのクリア

compare two string and pass the selected data within it

1 回表示 (過去 30 日間)
Santosh Biradar
Santosh Biradar 2022 年 8 月 30 日
回答済み: Santosh Biradar 2022 年 8 月 30 日
Hello
There are two strings.
chkDataFileName = ["20220329_112048_ADU_INPUT" ; "20220329_141153_ADU_INPUT" ; "20220329_142653_ADU_INPUT" ; "20220329_144153_ADU_INPUT" ; 20220329_160005_ADU_INPUT"]
Newlyaddednames = ["20220329_112048_1742.4" ; "20220329_112048_1760.2" ; "20220329_141153_3216.8" ; "20220329_142653_3802.2" ; "20220329_144153_4720.2" ; "20220329_160005_1738"]
for eg., compare both string, as 20220329_112048 is present in both string then it will result as,
>>BLF_Name="20220329_112048_ADU_INPUT"; SnapTime = "1742.4"
>>BLF_Name="20220329_112048_ADU_INPUT"; SnapTime = "1760.2"
Now compare both string, as 20220329_141153 is present in both string then it will send the result as,
>>BLF_Name="20220329_141153_ADU_INPUT"; SnapTime = "3216.8"
same result for rest
>>BLF_Name="20220329_142653_ADU_INPUT""; SnapTime = "3802.2"
>>BLF_Name="20220329_144153_ADU_INPUT""; SnapTime = "4720.2""
>>BLF_Name="20220329_160005_ADU_INPUT""; SnapTime = "1738"
Please let me know for brief.
Thank you
  2 件のコメント
Image Analyst
Image Analyst 2022 年 8 月 30 日
Will it always be the first 15 characters you're looking at when you try to match up strings? Or maybe up until you see "_ADU"?
Santosh Biradar
Santosh Biradar 2022 年 8 月 30 日
編集済み: Santosh Biradar 2022 年 8 月 30 日
Yes it will be always first 15 characters.for comparing we will consider this only 20220329_141153.
but while write final output it will be 20220329_141153_ADU_INPUT

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

採用された回答

Santosh Biradar
Santosh Biradar 2022 年 8 月 30 日
for i=1:length(chkDataFileName)
for j=1:length(Newlyaddednames)
inpSTR=char(chkDataFileName(i));
newSTR=char(Newlyaddednames(j));
if strfind(newSTR,inpSTR(1:end-10))
BLF_Name=chkDataFileName(i)
SnapTime = newSTR(17:end)
end
end
end

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by