Main Content

unit

Return unit associated with simscape.Value array

Since R2021b

Description

example

U = unit(V) returns the associated unit of the simscape.Value object, V, as a simscape.Unit object.

Examples

collapse all

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

collapse all

Array of numeric values with unit, specified as a simscape.Value object.

Example: 10 (m/s^2)

Output Arguments

collapse all

Unit associated with the simscape.Value object, V, returned as a simscape.Unit object. U is a 1x1 unit array.

Version History

Introduced in R2021b

expand all