newUnitSystem

Defines a new system of units.

Category: Symbolic Computations in MATLAB > Units of Measurement

Syntax

newUnitSystem(name, base)

Creates the system name with the given base units.

newUnitSystem(name, base, derived)

Also names the derived units of the system.

Description

A unit system is the choice of a set of base units from which all the others can be built. Once defined, the name appears in unitSystems and can be used as the target of unitConvert, which rewrites a quantity using that system's units.

The system lasts until removeUnitSystem is called or the session ends.

Input arguments

name
Name of the new system.
base
Base units, taken from baseUnits of an existing system.
derived
Derived units, for example from derivedUnits.

Example

Registering a system

newUnitSystem('MySys', baseUnits('SI'), derivedUnits('SI'));
unitSystems
removeUnitSystem('MySys');
Output
ans = 1×7 string array

    "CGS"    "EMU"    "ESU"    "GU"    "MySys"    "SI"    "US"

Notes

In MatLivre a new system is listed by unitSystems, but baseUnits and derivedUnits cannot query it, and unitConvert to it returns SI units.

See also

removeUnitSystem unitSystems baseUnits derivedUnits