unit
Syntax
Description
Examples
Extract Unit from simscape.Value
Object
Create a simscape.Value
object:
V = simscape.Value([10 20 30], 'm/s^2')
V = 10 20 30 (m/s^2)
Get the unit of the object:
U = unit(V)
U = m/s^2
Input Arguments
V
— Array of numeric values with unit
simscape.Value
object
Array of numeric values with unit, specified as a simscape.Value
object.
Example: 10 (m/s^2)
Output Arguments
U
— Unit associated with object V
simscape.Unit
object
Unit associated with the simscape.Value
object,
V
, returned as a simscape.Unit
object.
U
is a 1x1 unit array.
Version History
Introduced in R2021bR2024a: Compact display of simscape.Value
and simscape.Unit
objects
When you place simscape.Value
and simscape.Unit
objects in table, cell, and structure arrays, the Command Window displays their values and
units explicitly if they fit into the available width of the Command Window. For row vectors
greater than maximum width, empty vectors, and for single line display of matrices and row
vectors, you can still see only the object member dimensions and type.
In previous releases, the value and unit in a simscape.Value
object
were separated by a colon. Now, the unit is shown in parentheses after the value.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)