This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Find units in input


U = findUnits(expr)



U = findUnits(expr) returns a row vector of units in the symbolic expression expr.


Find Units in Expression

Find the units in an expression by using findUnits.

u = symunit;
syms x
units = findUnits(x*u.m + 2*u.N)
units =
[ [N], [m]]

Find Units in Array of Equations or Expressions

Find the units in an array of equations or expressions by using findUnits. The findUnits function concatenates all units found in the input to return a row vector of units. findUnits returns only base units.

u = symunit;
array = [2*u.m + 3*u.K, 1*u.N == 1**u.s^2)];
units = findUnits(array)
units =
[ [K], [N], [kg], [m], [s]]

Input Arguments

collapse all

Input, specified as a symbolic number, variable, vector, matrix, multidimensional array, function, or expression.

Introduced in R2017a