#!/bin/bash
# usage:
#   nmea2matrix < nmea-log.txt > matrix.asc
#
# convert NMEA track to Matlab/Octave style Matrix

if [ $# -ne 0 ]; then
  echo "usage: nmea2matrix < nmea-log.txt > matrix.asc"
  exit
fi

grep -e "^\$GPRMC" -e "^\$GPGGA" -e "^\$GPVTG" -e "^\$GPGSA" | \
gpsbabel -t -i nmea -f - -x discard,hdop=10,vdop=20 -o xcsv,style=/etc/gpsbabel/style/matrix_track.style -F -
