handle character minus character
Información
This question is locked. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I have two characters which contain '18:29:42.835' and '18:29:49.425'. How is it possible to subtrack t2-t1 so as to find duration?
1 comentario
Rena Berman
el 13 de En. de 2025
(Answers Dev) Restored edit
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 10 de Jul. de 2020
0 votos
If you have a recent enough MATLAB version, pass the character vectors to duration() and then subtract one from the other.
If your MATLAB is a bit older, then you will need to split the vectors at the colons, then str2double() to get the individual components, and pass those to duration.
Or you could use sscanf() with a format of '%f:%f:%f' to get the numeric components and pass those to duration()
This question is locked.
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!