This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Add new unit to unit registry


pm_addunit(unitname, conversion, unitexpression)


pm_addunit(unitname, conversion, unitexpression) introduces a new unit, unitname, defined as conversion * unitexpression.

The first argument, unitname, must be a valid unit name, that is, it must begin with a letter and contain only letters and numbers.

The second argument, conversion, may be either a positive real scalar or a 1x2 array. If this argument has two elements, then it is specifying an affine conversion, with the first element (a positive real number) being the linear conversion coefficient, and the second being the offset. For more information, see Thermal Unit Conversions.

The third argument, unitexpression, must be a valid unit expression in terms of units already defined in the unit registry.

The following operators are supported in the unit mathematical expressions:

+, -Plus, minus — for exponents only
()Brackets to specify evaluation order


Add a new unit centimeter, cm, in terms of meter, m:

pm_addunit('cm', 0.01, 'm');

Add a new unit newton, N, in terms of kilograms, meters, and seconds:

pm_addunit('N', 1, 'kg*m/s^2');

Add a new unit Fahrenheit, degF, in terms of Celsius:

pm_addunit('degF', [5/9 -32*5/9], 'degC');

Introduced in R2007a