nmea2deg

PURPOSE ^

NMEA2DEG Convert NMEA latitude and/or longitude degrees to decimal degrees.

SYNOPSIS ^

function varargout = nmea2deg(varargin)

DESCRIPTION ^

NMEA2DEG  Convert NMEA latitude and/or longitude degrees to decimal degrees.

  Syntax:
    DEG = NMEA2DEG(NMEA)
    [DEGLAT, DEGLON] = NMEA2DEG(NMEALAT, NMEALON)

  Description:
    DEG = NMEA2DEG(NMEA) converts the scalar or array NMEA from NMEA latitude
    or longitude degrees to decimal degrees applying the transformation:
      DEG = FIX(NMEA/100) + REM(NMEA,100)/60;

    [DEGLAT, DEGLON] = NMEA2DEG(NMEALAT, NMEALON) performs the same conversion
    to each of its input arguments separately.

  Examples:
    nmea2deg(3330.00)
    nmea = [36015.00 -445.25]
    deg = nmea2deg(nmea)
    nmealat = 3900.61662
    nmealon = 257.99996
    [deglat, deglon] = nmea2deg(nmealat, nmealon)

  Notes:
    The input values are not checked to be valid NMEA coordinate values.
    So no warning is produced if the degree digits are out of [0,180] or
    the integral part of de minute digits are out of [00,59].
  
  See also:
    FIX
    REM

  Authors:
    Joan Pau Beltran  <joanpau.beltran@socib.cat>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

nmea2deg.m

SOURCE CODE ^

0001 function varargout = nmea2deg(varargin)
0002 %NMEA2DEG  Convert NMEA latitude and/or longitude degrees to decimal degrees.
0003 %
0004 %  Syntax:
0005 %    DEG = NMEA2DEG(NMEA)
0006 %    [DEGLAT, DEGLON] = NMEA2DEG(NMEALAT, NMEALON)
0007 %
0008 %  Description:
0009 %    DEG = NMEA2DEG(NMEA) converts the scalar or array NMEA from NMEA latitude
0010 %    or longitude degrees to decimal degrees applying the transformation:
0011 %      DEG = FIX(NMEA/100) + REM(NMEA,100)/60;
0012 %
0013 %    [DEGLAT, DEGLON] = NMEA2DEG(NMEALAT, NMEALON) performs the same conversion
0014 %    to each of its input arguments separately.
0015 %
0016 %  Examples:
0017 %    nmea2deg(3330.00)
0018 %    nmea = [36015.00 -445.25]
0019 %    deg = nmea2deg(nmea)
0020 %    nmealat = 3900.61662
0021 %    nmealon = 257.99996
0022 %    [deglat, deglon] = nmea2deg(nmealat, nmealon)
0023 %
0024 %  Notes:
0025 %    The input values are not checked to be valid NMEA coordinate values.
0026 %    So no warning is produced if the degree digits are out of [0,180] or
0027 %    the integral part of de minute digits are out of [00,59].
0028 %
0029 %  See also:
0030 %    FIX
0031 %    REM
0032 %
0033 %  Authors:
0034 %    Joan Pau Beltran  <joanpau.beltran@socib.cat>
0035 
0036 %  Copyright (C) 2013-2016
0037 %  ICTS SOCIB - Servei d'observacio i prediccio costaner de les Illes Balears
0038 %  <http://www.socib.es>
0039 %
0040 %  This program is free software: you can redistribute it and/or modify
0041 %  it under the terms of the GNU General Public License as published by
0042 %  the Free Software Foundation, either version 3 of the License, or
0043 %  (at your option) any later version.
0044 %
0045 %  This program is distributed in the hope that it will be useful,
0046 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
0047 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0048 %  GNU General Public License for more details.
0049 %
0050 %  You should have received a copy of the GNU General Public License
0051 %  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0052 
0053   error(nargchk(1, 2, nargin, 'struct'));
0054   
0055   for varargidx = 1:numel(varargin)
0056     nmea = varargin{varargidx};
0057     deg = fix(nmea/100) + rem(nmea,100)/60;
0058     varargout{varargidx} = deg;
0059   end
0060 
0061 end

Generated on Fri 06-Oct-2017 10:47:42 by m2html © 2005