Quantcast

Documentation Center

  • Trial Software
  • Product Updates

dm2degrees

Convert degrees-minutes to degrees

Syntax

angleInDegrees = dm2degrees(DM)

Description

angleInDegrees = dm2degrees(DM) converts angles from degree-minutes representation to values in degrees which may include a fractional part (sometimes called "decimal degrees"). DM should be N-by-2 and real-valued, with one row per angle. The output will be an N-by-1 column vector whosekth element corresponds to the kth row of DM. The first column of DM contains the "degrees" element and should be integer-valued. The second column contains the "minutes" element and may have a fractional part For an angle that is positive (north latitude or east longitude) or equal to zero, all elements in the row need to be nonnegative. For a negative angle (south latitude or west longitude), the first nonzero element in the row should be negative and the remaining value, if any, should be nonzero. Thus, for an input row with value [D M], with integer-valued D and real M, the output value will be

SGN * (abs(D) + abs(M)/60)

where SGN is 1 if D and M are both nonnegative and -1 if the first nonzero element of [D M] is negative (an error results if a nonzero D is followed by a negative M). Any fractional parts in the first (degrees) columns of DM are ignored. An error results unless the absolute values of all elements in the second (minutes) column are less than 60.

Examples

dm = [ ...
      30  44.78012; ...
     -82  39.90825; ...
       0 -17.12345; ...
       0  14.82000];
format long g
angleInDegrees = dm2degrees(dm)

angleInDegrees =
          30.7463353333333
               -82.6651375
        -0.285390833333333
                     0.247

See Also

| | |

Was this topic helpful?