フィルターのクリア

String or Number to a time format

11 ビュー (過去 30 日間)
Nathan Kennedy
Nathan Kennedy 2017 年 10 月 6 日
回答済み: Walter Roberson 2017 年 10 月 6 日
I have the following stored in an array called timearray thats been imported form a csv file
22:30:26:718
The format is hh:mm:ss:sss With the last three 's' being milliseconds ... I want to convert to time format and tried this
date=datetime(timearray,'InputFormat', 'HH:MM:SS:SSS')
I get this error
Error using datetime (line 616)
Fractional seconds must be contiguous in a datetime format character vector.
Error in NoLensAnalysis (line 587)
date=datetime(raw_edited1,'InputFormat', 'HH:MM:SS:SSS')
I know this is simple to you but can you share your knowledge please?

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 10 月 6 日
date = datetime(timearray, 'InputFormat', 'HH:mm:ss:SSS');
but you probably want to proceed to
tod = timeofday(date);
tod.Format = 'HH:mm:ss.SSS';

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by