removeUnit

Removes a unit defined with newUnit.

Category: Symbolic Computations in MATLAB > Units of Measurement

Syntax

removeUnit(name)

Deletes the user-defined unit name.

Description

Only units added with newUnit can be removed. Asking to remove a built-in unit, such as m, or a name that was never defined raises an error. Quantities that already use the unit become meaningless afterwards, so convert or discard them first.

Input arguments

name
Name of a unit created by newUnit.

Example

Defining and removing a unit

u = symunit;
newUnit('Foo', 5*u.m);
u = symunit;
unitConvert(2*u.Foo, u.m)
removeUnit('Foo');
Output
ans = 10*[m]

See also

newUnit symunit removeUnitSystem