Converting Time to Numeric (Not Date)

I have a large dataset which I have to index on time. My data set will have large rows and 5 coloumns. One of the coloumns will be time denoted by HH:MM:SS. E.g 09:55:47. I have to index my numeric data based on the time. When I import my data, the data gets split into text data and numeric data. Unfortunately time goes into text data. When I tried using datanum converter, it gives me junk values because this is not date, rather time. Matlab has datenum to convert data into a numeric. datenum also converts Date with time to a numeric. But just time alone cannot be converted to a numeric directly. And this is my requirement as I want the time increments to be converted to numeric increments (which is the bare minimum to do my coding). I would be grateful for help on this.

답변 (1개)

Sachin Ganjare
Sachin Ganjare 2012년 10월 10일

0 개 추천

Did you try 'datevec' function?

댓글 수: 1

Aravind
Aravind 2012년 10월 10일
datavec needs the date also. When I give time as input, it gives a junk date appended with the converted time. Eg, 09:55:45 would return 2012 1 1 09 55 45. An extra junk three coloumns.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

질문:

2012년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by