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.

removeUnit

Syntax

removeUnit(unit)

Description

example

removeUnit(unit) removes the symbolic unit unit. You can remove only user-defined units created with newUnit. You cannot remove predefined units. If unit is a vector, removeUnit removes all units in unit.

Examples

collapse all

Remove units you define by using removeUnit. Create the unit warp3, use the unit in calculations, and then remove the unit.

Define the unit warp3 as 3 times the speed of light.

u = symunit;
warp3 = newUnit('warp3',3*u.c_0)
warp3 =
[warp3]

Convert 1e10 meter per second to u.warp3.

speed = rewrite(1e10*u.m/u.s,u.warp3)
speed =
(5000000000/449688687)*[warp3]

After calculations, remove the unit u.warp3 by using removeUnit.

removeUnit(u.warp3)

Conversion to u.warp3 now throws an error.

Input Arguments

collapse all

Unit name, specified as a symbolic unit or a vector of symbolic units.

Introduced in R2017b