This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Duration in milliseconds


MS = milliseconds(X)



MS = milliseconds(X) returns an array of milliseconds equivalent to the values in X.

  • If X is a numeric array, then MS is a duration array in units of milliseconds.

  • If X is a duration array, then MS is a double array with each element equal to the number of milliseconds in the corresponding element of X.


collapse all

X = magic(3);
MS = milliseconds(X)
MS = 3x3 duration array
   0.008 sec   0.001 sec   0.006 sec
   0.003 sec   0.005 sec   0.007 sec
   0.004 sec   0.009 sec   0.002 sec

Create a duration array.

X = minutes(2) + seconds(1:3)
X = 1x3 duration array
   2.0167 min   2.0333 min     2.05 min

Convert each duration in X to a number of milliseconds.

MS = milliseconds(X)
MS = 1×3

      121000      122000      123000

MS is a double array.

Input Arguments

collapse all

Input array, specified as a numeric array, duration array, or logical array.

Extended Capabilities

See Also

Introduced in R2015a