adding gps data from one file to another

I am using an underway system on a research vessel and the GPS logger was left ashore. DOH! So I would like to use the GPS from the ship data. However the ship GPS is logged every 10 seconds where my underway system logs every 1.5 minutes. Is there a way to have matlab look at both files, grab the gps data to the corresponding date and time in my underway log file, and then write the correct gps to the underway log file?
I am a novice user with matlab and have looked into the import feature, but I am not sure this is the write way to go. The underway file is an excel csv and the gps file from the ship is a .GPS file. Thanks in advance for any and all help.
Mike

Respuestas (1)

Star Strider
Star Strider el 19 de Ag. de 2015
Once you get the GPS data available to you, with the appropriate time stamps, I would first convert all the time stamps to datenum date numbers, and if necessary convert degrees-minutes-seconds latitude and longitude data to degrees and decimal degrees, then use the interp1 function.
For example,
Ship_GPS = [time lat lon]; % Assume Column Vectors
Underway_System [time other_data]; % Assume Column Vectors
Underway_GPS = interp1(Ship_GPS(:,1), Ship_GPS(:,2:3), Underway_System(:,1), 'linear', 'extrap');
You may not need the 'extrap' option, but it’s better to include it, especially if you have a lot of data and your routine will take a while to run.
You can then concatenate the interpolated ‘Underway_GPS’ (Nx2) matrix with your other ‘Underway_System’ data matrix.
This is quite obviously untested code, but it should work.

2 comentarios

Mike
Mike el 19 de Ag. de 2015
Thank you for such a quick response.
As stated I am fairly new to Matlab, Would I have to pull the files into Matlab as a matrix from their corresponding files? There are no column headers in the files, I could convert to excel and create headers. Would the variables listed in the code then need the column and row? Is that what you mean by Assume column vectors?
Walter Roberson
Walter Roberson el 19 de Ag. de 2015
A column vector is a 2D array that has only 1 column. A row vector is a 2D array that has only 1 row.
What form is the data stored in at the moment? It might not be necessary to save it as excel. MATLAB would not require column headers as long as you are consistent about which column is which.
You could use a xls or csv file that had a text date and time, then the latitude, then the longitude. Decimal degrees would be easiest for latitude and longitude.

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 19 de Ag. de 2015

Comentada:

el 19 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by