Convert numeric distance values into text
str = dist2str(distin)
str = dist2str(dist,format)
str = dist2str(dist,format,units)
str = dist2str(dist,format,digits)
str
= dist2str(dist,format,units,n)
str = dist2str(distin)
converts
a numerical vector of distances in kilometers, distin
,
to a character array. The output character array is useful for the
display of distances. The purpose of this function is to convert distance-valued
variables into text suitable for map display.
str = dist2str(dist,format)
specifies the notation to
be used for the character array in format
. If blank or
'none'
, the result is a simple numerical representation (no
indicator for positive distances, minus signs for negative distances). The only other
format is 'pm'
(for plus-minus) prefixes a
+
for positive distances.
str = dist2str(dist,format,units)
defines
the units in which the input distances are supplied. Units must be
one of the following: 'feet'
, 'kilometers'
, 'meters'
, 'nauticalmiles'
, 'statutemiles'
, 'degrees'
,
or 'radians'
. Note that statute miles are encoded
as 'mi'
in the character array, whereas in most Mapping Toolbox™ functions, 'mi'
indicates
international miles. If omitted or blank, 'kilometers'
is
assumed.
str = dist2str(dist,format,digits)
or str
= dist2str(dist,format,units,n)
uses the input n
to
determine the number of decimal digits in the output matrix. If n
= -2
, the default, dist2str
rounds to
the nearest hundredth. If n = 0
, dist2str
rounds
the output to the nearest integer. Note that this sign convention
for n
is opposite to the one used by the MATLAB® round
function.