Mapping Toolbox    
dist2str

Convert distance values to strings

Syntax

Description

The purpose of this command is to make distance-valued variables into strings suitable for map display.

str = dist2str(distin) converts the input vector of distances, distin, to a string matrix.

str = dist2str(distin,format) uses the format string to specify the notation to be used for the string matrix. The default, 'none', results in simple numerical representation (no indicator for positive distances, minus signs for negative distances); 'pm' (for plus-minus) prefixes a `+' for positive distances.

str = dist2str(distin,format,units) uses the input units to define the units in which the input distances are supplied. units is any valid distance string ('kilometers' are the default). units also determines which unit symbol to suffix to the strings.

str = dist2str(distin,format,units,digits) determines how many digits to display. digits is the power of 10 representing the last place of significance in the resulting output. For example, if digits = 2, the hundreds slot of will be its last significant figure. In general, the 10digits slot will be the last significant figure, rounded appropriately depending upon the value in the 10digits-1 slot. digits is -2 by default.

Examples

Create a vector of values and convert to strings:

Now change the units, add `+'s to positive values, and truncate to the tenths (10-1) slot:

See Also
angl2str
Convert angle values to strings
distdim
Convert distance units
time2str
Convert time values to strings


  displaym distance