How to remove the sec from the time when Timetable writing to .txt file?
70 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tom Wills
el 22 de Oct. de 2020
Comentada: Tom Wills
el 22 de Oct. de 2020
I am writing some code to write some captured data to a txt file. When I do this with the code below,
writetimetable(t,nameData);
The time colum has the time in seconds followed by "sec". Any methods for removing this.
2 comentarios
Sudhakar Shinde
el 22 de Oct. de 2020
The result you want to be only the numbers in 'Time' column without word 'sec'?
Respuesta aceptada
Adam Danz
el 22 de Oct. de 2020
Editada: Adam Danz
el 22 de Oct. de 2020
- Convert timetable to table using T = timetable2table(TT)
- Convert the duration column using S = seconds(X)
- Write that table using writetable(T)
Demo:
s = seconds(1:10)
sd = seconds(s)
Since you're working with a timetable, you'll need to convert it to a table,
tt = timetable(seconds(1:5)', (11:15)')
t = timetable2table(tt)
t.Time = seconds(t.Time)
Now you can write write the data using writetable(T)
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!