Main Content

convlength

Convert from length units to desired length units

Description

example

convertedValues = convlength(valuesToConvert,inputLengthUnits,outputLengthUnits) converts valuesToConvert from original units to desired units using computed conversion factor.

Examples

collapse all

Convert three lengths from feet to meters.

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

    0.9144    3.0480    6.0960

Input Arguments

collapse all

Input lengths to convert, specified as a floating-point array of m-by-n values, in original units. All values must have the same units.

Data Types: double

Original unit of input lengths, specified as:

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

Data Types: char | string

New unit to convert to, specified as:

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

Data Types: char | string

Output Arguments

collapse all

Converted lengths, returned in new units.

Introduced in R2006b