How to convert time stamp 11:21:17.155 into seconds in MATLAB??

3 次查看(过去 30 天)
I am quite not sure how to covert time stamps of this sort into seconds in MATLAB. Any help is appreciated.
Thank you

采纳的回答

Stephan
Stephan 2021-1-19
format longG
a = '11:21:17.155';
b = seconds(duration(a,'InputFormat','hh:mm:ss.SSS'))
results in:
b =
40877.155

更多回答(1 个)

Stephen23
Stephen23 2021-1-19
The most efficient solution:
a = '11:21:17.155';
b = [60*60,60,1]*sscanf(a,'%f:')
b =
40877.155

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by