How can I convert latitudes in degree-minute format to decimal degrees?

조회 수: 10 (최근 30일)
Meg Carr
Meg Carr 2020년 10월 18일
댓글: Andy 2020년 10월 20일
I have a dataset (in double format) consisting of latitudes: [4954 4958 NaN 5006] and another with longitudes: [6519 6424 NaN 6305]
The first two digits are degrees latitude or longitude, and the final two digits are minutes of latitude or longitude.
How can I most efficiently convert these to decimal-degree format?(E.g. 4954 ----> 49.90)
I attempted adding spaces between the degrees and minutes using regexp with the hope of then using dms2degrees, but couldn't figure out how to add a space between the digits. This doesn't seem efficient to me, so I am looking for a better method.

채택된 답변

Andy
Andy 2020년 10월 20일
latitudeDeg=floor(latitudes/100)+(rem(latitudes,100)*10/6)/100
  댓글 수: 2
Andy
Andy 2020년 10월 20일
I haven't done a full error check on it but it works with the data you have supplied. Glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by