Change data type of a table column into datetime?
조회 수: 47 (최근 30일)
이전 댓글 표시
Hi,
I have read a table with readtable and changed my the column with the time data to a char using detectImportOptions-function.
I now wanna change the data type from char to datetime but it doesnt work. How do i need to do it?
댓글 수: 0
답변 (2개)
Eric Sofen
2020년 6월 9일
Take a look at the convertvars function for changing the data type of a table variable.
Also, is there a reason you're bring in the time data as char rather than directly as datetime or duration from readtable?
댓글 수: 0
Drishti Jain
2020년 5월 28일
You can use datetime: https://in.mathworks.com/help/matlab/ref/datetime.html
e.g-
tm='10:14:25'
new_tm= datetime(tm,'Format','HH:mm:ss')
댓글 수: 1
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!