Main Content

unitSystems

List available unit systems

Description

example

unitSystems returns a row vector of available unit systems.

Examples

collapse all

Get available unit systems by using unitSystems. Add a custom unit system and check that unitSystems lists it as available.

Find the unit systems available by default.

unitSystems
ans = 
  1×6 string array
    "CGS"    "EMU"    "ESU"    "GU"    "SI"    "US"

Add a custom unit system that modifies the SI base units. For details, see newUnitSystem and Unit Conversions and Unit Systems.

u = symunit;
SIUnits = baseUnits('SI');
newUnits = subs(SIUnits,[u.m u.s],[u.km u.hr]);
newUnitSystem('SI_km_hr',newUnits)
ans = 
    "SI_km_hr"

Check that the new unit system is available by using unitSystems.

unitSystems
ans = 
  1×7 string array
    "CGS"    "EMU"    "ESU"    "GU"    "SI"    "SI_km_hr"    "US"

After calculations, remove the new unit system and check that it is unavailable.

removeUnitSystem('SI_km_hr');
unitSystems
ans = 
  1×6 string array
    "CGS"    "EMU"    "ESU"    "GU"    "SI"    "US"

Version History

Introduced in R2017b