Main Content

unitInfo

Information on units of measurement

Description

example

unitInfo(unit) returns information for the symbolic unit unit.

example

unitInfo(dim) returns available units for the dimension dim.

example

unitInfo returns a list of available physical dimensions.

example

A = unitInfo(___) returns the output in A using any of the input arguments in the previous syntaxes. Dimensions are returned as strings, and units are returned as symbolic units.

Examples

collapse all

Find information on unit u.Wb where u = symunit. The unitInfo function specifies that Wb is the SI unit of magnetic flux.

u = symunit;
unitInfo(u.Wb)
weber - a physical unit of magnetic flux. ['SI']

Get all units for measuring 'MagneticFlux' by calling unitInfo('MagneticFlux').
SI units accept all SI prefixes. For details, see SI Unit Prefixes List.

Find all available units for 'MagneticFlux' as described.

unitInfo('MagneticFlux')
All units of dimension 'MagneticFlux':

abWb - abweber
Mx - maxwell
phi_0 - magnetic flux quantum
statWb - statweber
Wb - weber ['SI']

Get the base SI units of any unit above by calling rewrite(<unit>,'SI').
SI units accept all SI prefixes. For details, see SI Unit Prefixes List.

unitInfo also returns information on compound units. Find information on u.m/u.s^2.

unitInfo(u.m/u.s^2)
meter per square second - a physical unit of acceleration. ['SI']

Get all units for measuring 'Acceleration' by calling unitInfo('Acceleration').
SI units accept all SI prefixes. For details, see SI Unit Prefixes List.

Return all available dimensions using unitInfo without input arguments.

unitInfo
"AbsorbedDose"
"AbsorbedDoseOrDoseEquivalent"
"AbsorbedDoseRate"
"Acceleration"
...
...
"Length"
"Luminance"
"LuminousEfficacy"
...
...
"Torque"
"Velocity"
"Volume"

Store information returned by unitInfo for use by providing an output.

Store the dimension of u.C.

u = symunit;
dimC = unitInfo(u.C)
dimC = 
    "ElectricCharge"

Find and store all units for the dimension dimC.

unitsEC = unitInfo(dimC)
unitsEC =
   [abC]
     [C]
     [e]
    [Fr]
 [statC]

Find information on the third unit of unitsEC.

unitInfo(unitsEC(3))
elementary charge - a physical unit of electric charge.

Get all units for measuring 'ElectricCharge' by calling unitInfo('ElectricCharge').

Store [e]. Then, find the number of electrons in a coulomb of electric charge.

electronCharge = unitsEC(3);
numElectrons = simplify(u.C/electronCharge)
numElectrons =
5000000000000000000000000000/801088317

Show that approximately 6.24 x 1018 electrons are in a coulomb by converting the high-precision symbolic result to double.

numElectrons = double(numElectrons)
numElectrons =
   6.2415e+18

Input Arguments

collapse all

Unit name, specified as a symbolic unit, character vector, or string. If unit is not a known base or derived unit in Units and Unit Systems List, then A = unitInfo(unit) returns an empty string "".

Example: unitInfo(u.m) where u = symunit

Dimension, specified as a character vector or string.

Example: unitInfo('Length')

Version History

Introduced in R2017b