unitsratio
Conversion factor between units
Description
C = unitsratio(
returns the conversion factor targetUnit
,originalUnit
)C
between units so that a value in
the original unit originalUnit
multiplied by
C
provides the equivalent value in the target unit
targetUnit
.
Examples
Conversion Factor Between Units
Find the conversion factor for international feet to meters.
mPerFoot = unitsratio("meter","feet")
mPerFoot = 0.3048
Convert 100 international feet to meters.
m = mPerFoot*100
m = 30.4800
Find the inverse conversion factor and multiply it by the mPerFoot
conversion factor.
unitsratio("feet","meter")*mPerFoot
ans = 1.0000
Input Arguments
originalUnit
— Original unit of measure
"kilometer"
| "kilometers"
| "km"
| "degree"
| "degrees"
| "deg"
| ...
Original unit of measure, specified as one of these options:
These angular units.
Value Unit Name "degree"
,"degrees"
,"deg"
Degrees "radian"
,"radians"
,"rad"
Radians Any length unit supported by the
validateLengthUnit
function.Value Unit Name "m"
,"meter"
,"meters"
,"metre"
,"metres"
Meters "cm"
,"centimeter"
,"centimeters"
,"centimetre"
,"centimetres"
Centimeters "mm"
,"millimeter"
,"millimeters"
,"millimetre"
,"millimetres"
Millimeters "micron"
,"microns"
Microns "km"
,"kilometer"
,"kilometers"
,"kilometre"
,"kilometers"
Kilometers "nm"
,"naut mi"
,"nautical mile"
,"nautical miles"
Nautical miles "ft"
,"international ft"
,"foot"
,"international foot"
,"feet"
,"international feet"
Feet "in"
,"inch"
,"inches"
Inches "yd"
,"yds"
,"yard"
,"yards"
Yards "mi"
,"mile"
,"miles"
,"international mile"
,"international miles"
Miles "sf"
,"survey ft"
,"US survey ft"
,"U.S. survey ft"
,"survey foot"
,"US survey foot"
,"U.S. survey foot"
,"survey feet"
,"US survey feet"
,"U.S. survey feet"
U.S. survey feet "sm"
,"survey mile"
,"survey miles"
,"statute mile"
,"statute miles"
,"US survey mile"
,"US survey miles"
,"U.S. survey mile(s)"
,"U.S. survey miles"
U.S. survey miles (statute miles) "Clarke's foot"
,"Clarkes foot"
Clarke's feet "German legal metre"
,"German legal meter"
German legal metres "Indian foot"
Indian feet
This argument is case insensitive.
Data Types: char
| string
targetUnit
— Target unit of measure
"kilometer"
| "kilometers"
| "km"
| "degree"
| "degrees"
| "deg"
| ...
Target unit of measure, specified as one of these options:
These angular units.
Value Unit Name "degree"
,"degrees"
,"deg"
Degrees "radian"
,"radians"
,"rad"
Radians Any length unit supported by the
validateLengthUnit
function.Value Unit Name "m"
,"meter"
,"meters"
,"metre"
,"metres"
Meters "cm"
,"centimeter"
,"centimeters"
,"centimetre"
,"centimetres"
Centimeters "mm"
,"millimeter"
,"millimeters"
,"millimetre"
,"millimetres"
Millimeters "micron"
,"microns"
Microns "km"
,"kilometer"
,"kilometers"
,"kilometre"
,"kilometers"
Kilometers "nm"
,"naut mi"
,"nautical mile"
,"nautical miles"
Nautical miles "ft"
,"international ft"
,"foot"
,"international foot"
,"feet"
,"international feet"
Feet "in"
,"inch"
,"inches"
Inches "yd"
,"yds"
,"yard"
,"yards"
Yards "mi"
,"mile"
,"miles"
,"international mile"
,"international miles"
Miles "sf"
,"survey ft"
,"US survey ft"
,"U.S. survey ft"
,"survey foot"
,"US survey foot"
,"U.S. survey foot"
,"survey feet"
,"US survey feet"
,"U.S. survey feet"
U.S. survey feet "sm"
,"survey mile"
,"survey miles"
,"statute mile"
,"statute miles"
,"US survey mile"
,"US survey miles"
,"U.S. survey mile(s)"
,"U.S. survey miles"
U.S. survey miles (statute miles) "Clarke's foot"
,"Clarkes foot"
Clarke's feet "German legal metre"
,"German legal meter"
German legal metres "Indian foot"
Indian feet
This argument is case insensitive.
Data Types: char
| string
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)