How can I convert number to time?

7 次查看(过去 30 天)
Jack Rogers
Jack Rogers 2020-2-13
I have a column of data ranging from 1 to 58,232 that represents time. 10 units represents 1 second, I need to convert this column into Minutes:seconds:milliseconds so that it is easier to understand when it comes to plotting the data set on to a graph. Would anyone know how I would be able to achieve this?
Thanks, Jack.

回答(1 个)

Star Strider
Star Strider 2020-2-13
If you have R2015b or later, this is straightforward:
v = 1:58232;
tsec = seconds(v/10);
Show = tsec(1:18) % Sample Result (Delete)
producing:
Show =
1×19 duration array
Columns 1 through 9
0.1 sec 0.2 sec 0.3 sec 0.4 sec 0.5 sec 0.6 sec 0.7 sec 0.8 sec 0.9 sec
Columns 10 through 18
1 sec 1.1 sec 1.2 sec 1.3 sec 1.4 sec 1.5 sec 1.6 sec 1.7 sec 1.8 sec
See the documentation on seconds for details.

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by