Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 setup and equation sections 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.

Introduced in R2008b

Was this topic helpful?