Units Functions (2)

Unit conversion operations

to
Change the unit of a value.
Syntax
x to unit | to(x | unit)
Parameters
NameTypeDescription
xUnit | Array | MatrixThe unit to be converted.
unitUnit | Array | MatrixNew unit. Can be a string like "cm"
Returns
Unit | Array | Matrix โ€” value with changed, fixed unit.
Examples
5 inch to cm
3.2kg to g
16 bytes in bits
See Also
toBest
Converts to the most appropriate display unit.
Syntax
toBest(x) | toBest(x | unitList)
Parameters
NameTypeDescription
xUnitThe unit to be converted
optionsObjectOptional options object
Returns
Unit โ€” Value converted to the best matching unit
Examples
toBest(unit(5000
m"))
toBest(unit(3500000
W"))
toBest(unit(0.000000123
See Also