How to read hh:mm:ss.sss time format from a file that has time and other data

4 views (last 30 days)
Nada Elsharkawy
Nada Elsharkawy on 24 Nov 2021
Edited: Stephen on 24 Nov 2021
Basically I am working with generated ECG data.
The data is stoed as follows in the file as points
00:00:00.000 -0.060
00:00:00.010 -0.065
00:00:00.020 -0.060
00:00:00.030 -0.075
00:00:00.040 -0.065
00:00:00.050 -0.070
00:00:00.060 -0.070
and so on.
when I load the data from the file Matlab interpets it as this:
0 -0.0600000000000000
0 -0.0650000000000000
0 -0.0600000000000000
0 -0.0750000000000000
0 -0.0650000000000000
0 -0.0700000000000000
0 -0.0700000000000000
0 -0.0900000000000000
how do I fix this, i need the time format to be changed to seconds

Answers (1)

Stephen
Stephen on 24 Nov 2021
Edited: Stephen on 24 Nov 2021
Because you did not upload a sample file I had to create my own (attached).
T = readtable('test.txt')
T = 7×2 table
Var1 Var2 ____________ ______ 00:00:00.000 -0.06 00:00:00.010 -0.065 00:00:00.020 -0.06 00:00:00.030 -0.075 00:00:00.040 -0.065 00:00:00.050 -0.07 00:00:00.060 -0.07
T.Var1
ans = 7×1 duration array
00:00:00.000 00:00:00.010 00:00:00.020 00:00:00.030 00:00:00.040 00:00:00.050 00:00:00.060

Community Treasure Hunt

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

Start Hunting!