MATLAB: Converting UTC time to seconds

MATLABtime series

I have a UTC Time stamp on my acquired data in format :
hh:mm:ss.SSSS
This data is taken at 20 ms and I need it to convert to duration in seconds and make a time series of it taking into account the start time and end time (even milli seconds taken into account)
I am currently using :
Dp = duration(hh,mm:mm,ss:ss);
tp= (minutes(D))*60;
Guidance required to make it into a time series which is generic in way that milli seconds are taken into account as well.

Best Answer

s = '12:34:56.789';
formatSpec = 'hh:mm:ss.SSS';
d = duration(s, 'InputFormat', formatSpec, 'Format', formatSpec)
d = duration
12:34:56.789
Related Question