How to read time from a .txt file ?
9 views (last 30 days)
Show older comments
I have got a column of time in the format "hh:mm:ss.SSS". How do i read this entire column in Matlab and convert it into decimal ?
1 Comment
madhan ravi
on 5 Mar 2019
Use readtable() to read the file.
The problem is Matlab is only reading hh:mm:ss . I have my data in milliseconds like this 00:00:01.456 . How do i potentially convert this to decimal system?
With the example you gave it worked fine for me. Perhaps show the code that you are trying to read the file and if possible upload the file.
Answers (1)
Prajwal Kadlaplamutt Ravindra Kumar
on 5 Mar 2019
1 Comment
Peter Perkins
on 11 Mar 2019
Prajwal, this may just be a display issue. Try this:
t.Time.Format = "hh:mm:ss.SSS"
(Substitute the correct names of your table and the time variable.) If that's not it, you should confirm that you are reading them in as durations (which has only been suppoted since R2018a IIRC).
Your code uses load. I'm not even sure what that would do on your file. Use readtable.
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!