converting miliseconds to datetime value in datastore

조회 수: 1 (최근 30일)
minomi
minomi 2017년 6월 19일
답변: dpb 2017년 6월 19일
Hi,
I have a set of data with the 2nd column representing the time and being in the form:
11:04:30.111234
I'm using tall arrays and datestore and was trying to use:
ds.SelectedFormats(2) = {'%{HH:mm:SS.ffffff}D'};
to set the second column as datetime value. But because of the miliseconds (.fffff) I get the errors:
Error using matlab.io.datastore.TabularTextDatastore/preview (line 39) Unable to read the DATETIME data with the format 'HH:mm:SS.ffffff'. If the data is not a time, use %q to get text data.
Can anyone help?

답변 (1개)

dpb
dpb 2017년 6월 19일
Bad format string...use
'%{HH:mm:ss.SSSSSS}D'
instead. Cap 'S' is fractional seconds, lowercase 's' is seconds with datetime; the 'SS.fff' is datenum syntax. Confusing and hard to keep straight I know... <Format>

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by