str = angl2str(angles)
converts numeric angles in degrees to a character array that represents the angles. This
function is useful for displaying angles as text on maps.
str = angl2str(angles,signcode,format)
returns a character array that formats the angles as degrees, degrees-minutes,
degrees-minutes-seconds, or radians. The function does not convert degrees to radians or
vice-versa.
Angles in degrees or radians, specified as a numeric array.
Signs or directions to use in the character array, specified as one of these options:
"ew" — Input angles are longitudes. The character array
indicates positive longitudes using E and negative longitudes
using W.
"ns" — Input angles are latitudes. The character array
indicates positive latitudes using N and negative latitudes
using S.
"pm" — The character array indicates positive angles using
a plus sign (+) and negative angles using a minus sign
(-).
"none" — The character array indicates negative angles
using a minus sign (-) and does not use a plus sign
(+) for positive angles.
Data Types: char | string
Format to use in the character array, specified as one of these
options.
Option
Format
Example
"degrees"
Degrees
angl2str(31.26,"none","degrees")
ans =
' 31.26^{\circ} '
"degrees2dm"
Degrees-minutes (DM)
angl2str(31.26,"none","degrees2dm")
ans =
' 31^{\circ} 15.60' '
"degrees2dms"
Degrees-minutes-seconds (DMS)
angl2str(31.26,"none","degrees2dms")
ans =
' 31^{\circ} 15' 36.00" '
"radians"
Radians
angl2str(pi/6,"none","radians",-5)
ans =
' 0.52360 R '
The value ^{\circ} is the LaTeX representation of
°.
Data Types: char | string
Number of digits to include in the character array, specified as an integer. When
you specify n, the angl2str function rounds
angles to the nearest multiple of
10n.
The sign convention for this argument is opposite to the one used by the round function.
Example: angl2str(31.467,"none","degrees",-2) returns '
31.47^{\circ} ', which is 31.467 rounded to the nearest
hundredth.
Example: angl2str(31.467,"none","degrees",0) returns '
31^{\circ} ', which is 31.467 rounded to the nearest
integer.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.