MATLAB Answers

How can I convert number to time?

2 views (last 30 days)
Jack Rogers
Jack Rogers on 13 Feb 2020
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.

  0 Comments

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 13 Feb 2020
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.

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by