Main Content
separateUnits
Separate units from expression
Description
Examples
Input Arguments
Output Arguments
Tips
If an expression has incompatible units, then
separateUnits
errors. Units are incompatible when they do not have the same dimensions, such as length and time.For example, this code will error.
u = symunit; [Data,Units] = separateUnits(2*u.m + 3*u.s)
Instead, to return the units in the input, use
findUnits
.Units = findUnits(2*u.m + 3*u.s)
Units = [[m], [s]]
Version History
Introduced in R2017aSee Also
checkUnits
| findUnits
| isUnit
| newUnit
| symunit
| str2symunit
| symunit2str
| unitConversionFactor