Using datevec with hh.mm.ss.ss gives error [R2017b]
조회 수: 2 (최근 30일)
이전 댓글 표시
Good afternoon,
I have found some similar questions but none that ask this specific case and I have tried just about every possible solution I can think of, but very much need to use datevec and retain the decimal seconds portion of the seconds. I have a data acquisition file with a very high sample rate (96000 samples per second). The time stamp is in the format hh:mm:ss.ss (note it is not hh:mm:ss.sss). I have tried the following formats with the datevec function and none are working:
datevec(data,'hh:mm:ss.ff')
datevec(data,'hh:mm:ss.ss')
datevec(data,'hh:mm:ss.SS')
Is this possible with datevec?
Cheers, TJ
답변 (1개)
Jan
2017년 12월 20일
'HH:MM:SS.FFF'
The upper-case matters, because e.g. 'mm' is the month with 2 digits. There is no "ff" format specifier, but only "FFF".
If you post the inputs you have, suggesting and testing code would be easier. I using the correct format specifiers does not help, what about using a simple sscanf instead?
data = '23:17:54.21'
n = sscanf(data, '%d:%d:%f', [1, 3]);
vec = [zeros(1, 3), n];
참고 항목
카테고리
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!