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.

convlength

Convert from length units to desired length units

Syntax

convertedValues = convlength(valuesToConvert,inputLengthUnits,outputLengthUnits)

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. Supported units are:

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

outputLengthUnits

Specified output length units. Supported units 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

Introduced in R2006b