Function File: validateLengthUnit (unit)
Function File: validateLengthUnit (unit, ind)
Function File: validateLengthUnit (unit, func)
Function File: validateLengthUnit (unit, func, name)
Function File: validateLengthUnit (unit, func, name, ind)

Check validity and standardize unit of length.

Confirms that the argument input is a valid length unit as described on the table below, and returns a string with its standard name. If unit is not a valid length unit, throws an error with a message following the Octave guidelines. For a more informative error message, the function name func, the argument name name, and its position in the input ind can be defined.

"meter"

m, meter(s), metre(s)

"centimeter"

cm, centimeter(s), centimetre(s)

"millimeter"

mm, millimeter(s), millimetre(s)

"micron"

micron(s)

"kilometer"

km, kilometer(s), kilometre(s)

"nautical mile"

nm, naut mi, nautical mile(s)

"foot"

ft, international ft, foot, international foot, feet, international feet

"inch"

in, inch, inches

"yard"

yd, yds, yard(s)

"mile"

mi, mile(s), international mile(s)

"U.S. survey foot"

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 mile (statute mile)"

sm, survey mile(s), statute mile(s), US survey mile(s), U.S. survey mile(s)

"Clarke's foot"

Clarke’s foot, Clarkes foot

"German legal metre"

German legal metre, German legal meter

"Indian foot"

Indian foot

See also: units, unitsratio, validateattributes, validatestring.

Package: mapping