www.gusucode.com > map 案例源码 matlab代码程序 > map/ComputeConversionRatioBetweenUnitsOfLengthExample.m

    %% Compute Conversion Ratio Between Units of Length
% This example shows how to use the |unitsratio| function to create a
% conversion factor for many different units of length, such as microns,
% millimeters, inches, international feet, and U.S. survey feet. The
% unitsratio function also lets you convert angles between degrees and
% radians. For more information, see <docid:map_ref.f15-585478>.
%%
% Create a conversion factor for inches to centimeters and convert 4 inches
% into centimeters.

% Copyright 2015 The MathWorks, Inc.

cmPerInch = unitsratio('cm','inch')
cm = cmPerInch * 4
%%
% Create the inverse conversion factor and multiply it by the |cmPerInch|
% conversion factor.
inch = unitsratio('in','centimeter') * cmPerInch