How to extract date and time that not in datetime format?
1 回表示 (過去 30 日間)
古いコメントを表示
File name example
20160914_565w081_Laurel_Washingtondc_jb_jr_161451_001.mat
20160914 date 161451 time
The position of the date and time in the file name will be the same for all files. The file name data is a string stored in a cell
I need to create a time series (e.g. ts = timeseries(data,time) creates the time-series object using the specified data and time.) using the date and time from the file name as the ts.TimeInfo.StartDate
How do I extract the date and time from the file name to appear in the format of the the StartDate property.
ts.TimeInfo.StartDate = '10/27/2005 07:05:36';
0 件のコメント
採用された回答
Walter Roberson
2018 年 4 月 12 日
dates = cellfun( @(S) datetime(S([1:8, 44:49]), 'InputFormat', 'yyyyMMddHHmmss', 'Format', 'MM/dd/yyyy HH:mm:ss'), FileNamesCell );
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!