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
답변 (1개)
Star Strider
2015년 8월 19일
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
Mike
2015년 8월 19일
Walter Roberson
2015년 8월 19일
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.
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!