Main Content

unitsratio

Conversion factor between units

Description

C = unitsratio(targetUnit,originalUnit) returns the conversion factor C between units so that a value in the original unit originalUnit multiplied by C provides the equivalent value in the target unit targetUnit.

example

Examples

collapse all

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

collapse all

Original unit of measure, specified as one of these options:

  • These angular units.

    ValueUnit Name
    "degree", "degrees", "deg"Degrees
    "radian", "radians", "rad"Radians
  • Any length unit supported by the validateLengthUnit function.

    ValueUnit 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

Target unit of measure, specified as one of these options:

  • These angular units.

    ValueUnit Name
    "degree", "degrees", "deg"Degrees
    "radian", "radians", "rad"Radians
  • Any length unit supported by the validateLengthUnit function.

    ValueUnit 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

See Also

Functions