Main Content

milliseconds

Duration in milliseconds

Description

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.

example

Examples

collapse all

X = magic(3);
MS = milliseconds(X)
MS = 3x3 duration
   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
   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

Version History

Introduced in R2015a

See Also