unitConvert
Convert units to other units of measurement
Syntax
Description
unitConvert(
converts expr
,unitSystem
)expr
to the unit system
unitSystem
. By default, the SI, CGS, and US unit
systems are available. You can also define custom unit systems by using
newUnitSystem
.
unitConvert(
converts units to derived units of expr
,unitSystem
,'Derived'
)unitSystem
.
___ = unitConvert(___,
indicates whether temperatures represent absolute temperatures or temperature
differences by specifying 'Temperature'
,convMode
)'absolute'
or
'difference'
respectively, using input arguments in the
previous syntaxes. The 'Temperature'
argument affects only
conversion between units of temperature. By default, temperatures are assumed to
be differences.
Examples
Input Arguments
Limitations
When using symbolic units, the value of
0
times a symbolic unit is returned as a dimensionless0
. To preserve the unit when multiplying a symbolic unit by0
, use a cell array to represent the zero measurement.For example, you can define
0
degrees Celsius as a cell array and convert it to degrees Fahrenheit by using theunitConvert
function.u = symunit; tC = {0,u.Celsius}; tF = unitConvert(tC,u.Fahrenheit,'Temperature','Absolute')
tF = 32*[Fahrenheit]
Version History
Introduced in R2018b