Main Content

value

Convert variable or parameter to unitless value with specified unit conversion

Syntax

value(a,'unit')
value(a,'unit','type')

Description

value(a,'unit') returns a unitless numerical value, converting a into units unit. a is a variable or parameter, specified as a value with unit, and unit is a unit defined in the unit registry. unit must be commensurate with the units of a.

value(a,'unit','type') performs either linear or affine conversion of temperature units and returns a unitless numerical value, converting a into units unit. type specifies the conversion type and can be one of two strings: linear or affine. If the type is not specified when converting temperature units, it is assumed to be affine.

Use this function in the equation section of a Simscape™ file to convert a variable or parameter into a scalar value.

Examples

If a = { 10, 'cm' }, then value(a, 'm') returns 0.1.

If a = { 10, 'C' }, then value(a, 'K', 'linear') returns 10.

If a = { 10, 'C' }, then value(a, 'K', 'affine') returns 283.15. value(a, 'K') also returns 283.15.

If a = { 10, 'cm' }, then value(a, 's') issues an error because the units are not commensurate.

Version History

Introduced in R2008b