フィルターのクリア

Removing first fewcharacters from a String

2 ビュー (過去 30 日間)
Alexander Tollinger
Alexander Tollinger 2020 年 4 月 11 日
編集済み: Ameer Hamza 2020 年 4 月 11 日
Hey guys i have simple problem,
i have the following string:
y= "TDS 2002C - 10:42:25 08.10.2011"
Now i want to trim the string, so that i only shows the date. Meaning 08.10.2011 , I dont need the rest of the string.
Can somebody help me ?
Regards,
Alex

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 11 日
編集済み: Ameer Hamza 2020 年 4 月 11 日
If all the strings have the same format and date occurs at the end then following will work.
y = "TDS 2002C - 10:42:25 08.10.2011";
date = char(y);
date = string(date(end-9:end));
A general approach
y = "TDS 2002C - 10:42:25 08.10.2011";
date = regexp(y, '[0-9]{2}\.[0-9]{2}\.[0-9]{4}', 'match');

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by