Documentation Center

  • Trial Software
  • Product Updates

convlength

Convert from length units to desired length units

Syntax

convertedValues = convlength(valuesToConvert, inputLengthUnits, outputLengthUnits)
m

Description

convertedValues = convlength(valuesToConvert, inputLengthUnits, outputLengthUnits) computes the conversion factor from specified input length units to specified output length units. It then applies the conversion factor to the input to produce the output in the desired units.

Input Arguments

valuesToConvert

Floating-point array of size m-by-n values that the function is to convert. All values must have the same unit conversions from inputLengthUnits to outputLengthUnits.

inputLengthUnits

Specified input length units, as strings. Supported unit strings are:

'ft'Feet
'm'Meters
'km'Kilometers
'in'Inches
'mi'Miles
'naut mi'Nautical miles

outputLengthUnits

Specified output length units, as strings. Supported unit strings are:

'ft'Feet
'm'Meters
'km'Kilometers
'in'Inches
'mi'Miles
'naut mi'Nautical miles

Output Arguments

convertedValues

Floating-point array of size m-by-n values that the function has converted.

Examples

Convert three lengths from feet to meters:

a = convlength([3 10 20],'ft','m')

a =

    0.9144    3.0480    6.0960

See Also

| | | | | | | | |

Was this topic helpful?