milliseconds
Duration in milliseconds
Syntax
Description
MS = milliseconds(
returns
an array of milliseconds equivalent to the values in X
)X
.
If
X
is a numeric array, thenMS
is aduration
array in units of milliseconds.If
X
is aduration
array, thenMS
is adouble
array with each element equal to the number of milliseconds in the corresponding element of X.
Examples
Create Duration Array of Milliseconds
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
Convert Durations to Numeric Array of Milliseconds
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
X
— Input array
numeric array | duration array | logical array
Input array, specified as a numeric array, duration array, or logical array.
Extended Capabilities
Tall Arrays
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
This function fully supports code generation. For more information, see Code Generation for Duration Arrays (MATLAB Coder).
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced in R2015a
See Also
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)