units_get_scaleΒΆ
units_get_scale returns the factor and offset to convert the data from one unit to the other.
-
rvScale = units_get_scale(oUnit, ssFrom, ssTo)
Return Value
rvScale is a vector with two elements. rvScale[1] is the factor and
rvScale[2] is the offset. If one of the units is invalid (not in the table),
the return value is [0,0]
.
Parameters
-
oUnit
Units-Converter-Objekt, see units.
-
ssFrom
ssFrom is a unit from the unit or alias table (see Unit Converter). If ssFrom is an empty string, the return value is scaling from the SI unit to the ssTo unit.
-
ssTo
ssTo is the result unit. If ssTo is an empty string the Scaling to the SI unit is returned.
Comment
The units_get_scale(oUnit, ssFrom, ssTo)
can also be invoked in the
following form: oUnit.scale(ssFrom, ssTo)
.
Example
u = units()
rvScale = units_get_scale(u, "PS")
rvScale
735.4987 0.0000
P_ps = 100
P_watt = rvScale[1] * P_ps + rvScale[2];
73549.8749
rvScale = u.scale("PS", "kW")
P_kW = rvScale[1] * P_ps + rvScale[2]
P_kW
73.5499
History
Version | Description |
---|---|
R2013.11 | New. |
See also
id-1218826