How to convert time stamp 11:21:17.155 into seconds in MATLAB??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Suvvi Kuppur Narayana Swamy
am 19 Jan. 2021
Kommentiert: Stephen23
am 19 Jan. 2021
I am quite not sure how to covert time stamps of this sort into seconds in MATLAB. Any help is appreciated.
Thank you
2 Kommentare
Mathieu NOE
am 19 Jan. 2021
hello
try this :
a = '11:21:17.155';
n = split(a,':');
duration_seconds = str2num(n{1})*3600+str2num(n{2})*60+str2num(n{3})
Stephen23
am 19 Jan. 2021
a = '11:21:17.155';
b = [60*60,60,1]*str2double(split(a,':'))
Akzeptierte Antwort
Stephan
am 19 Jan. 2021
format longG
a = '11:21:17.155';
b = seconds(duration(a,'InputFormat','hh:mm:ss.SSS'))
results in:
b =
40877.155
0 Kommentare
Weitere Antworten (1)
Stephen23
am 19 Jan. 2021
The most efficient solution:
a = '11:21:17.155';
b = [60*60,60,1]*sscanf(a,'%f:')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!