Main Content

removeUnitSystem

Remove unit system

Description

example

removeUnitSystem(unitSystem) removes the unit system unitSystem. You can remove only user-defined unit systems created with newUnitSystem. You cannot remove predefined unit systems listed in Unit Systems List.

Examples

collapse all

Define a unit system, use the unit system to rewrite units, and then remove the unit system by using removeUnitSystem.

Define the unit system mySystem with SI base units and the derived unit kilowatt hour.

u = symunit;
bunits = baseUnits('SI');
dunits = [u.kWh];
mySystem = newUnitSystem('mySystem',bunits,dunits)
mySystem = 
    "mySystem"

Convert 50,000 Joules to derived units of mySystem by using rewrite with the third argument 'Derived'. As expected, the result is in kilowatt hour.

rewrite(50000*u.J,mySystem,'Derived')
ans =
(1/72)*[kWh]

Remove the unit system mySystem by using removeUnitSystem.

removeUnitSystem(mySystem)

Converting units to mySystem now throws an error.

Input Arguments

collapse all

Name of the unit system, specified as a string or character vector.

Version History

Introduced in R2017b