Main Content

value

Convert variable or parameter to unitless value with specified unit conversion

Parent Section: equations

Syntax

value(a,'unit')

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 equations section of a Simscape™ file to convert a variable or parameter into a scalar value.

Examples

expand all

If a = {10,'cm'}, then:

  • value(a,'m') returns 0.1.

  • value(a,'s') issues an error because the units are not commensurate.

If a = {10,'C'}, then:

  • value(a,'K','linear') returns 10.

  • value(a,'K','affine') returns 283.15.

  • value(a,'K') returns 283.15 because, by default, temperature unit conversion in affine.

Version History

Introduced in R2008b