How to synchronize two different timetable (Each has a different time format)

How to add dates to an already created timetable?
Timeline = xlsread('Timeline.xlsx');
Lidar_DeltaT = Timeline(2, 1);
GPS_DeltaT = Timeline(3, 1);
Lidar_Distance= readtimetable('Lidar Cycle.txt');
summary(Lidar_Distance);
Lidar_Distance.Time = Lidar_Distance.Time + seconds(Lidar_DeltaT);
GPS_Velocity = readtimetable('GPS cycle 1.txt');
summary(GPS_Velocity)
GPS_Velocity.Time = GPS_Velocity.Time + seconds(GPS_DeltaT);
TT_Sync = synchronize(Lidar_Distance, GPS_Velocity, 'Uniform');
with it,
Lidar_Distance timetable look like this :
And GPS_Velocity timetable look like this :
I want to synchronize two time tables. But It fails every time because of time format difference.
I don't know how to settle this two timetables into one timetable.
And I also want to set the reference time format of the two timetables to GPS. This is because the GPS time interval is tighter. After that, I want to make two timetables into one, and treat the missing data in the Lidar_Distance timetable as a value of '0'.
(This is because the GPS_Velocity data is consistently recorded in units of 1 second, while the Lidar_Distance data sometimes skips 2 seconds.)

 Respuesta aceptada

Cris LaPierre
Cris LaPierre el 23 de Ag. de 2020
Editada: Cris LaPierre el 23 de Ag. de 2020
Did you see the answer I provided in your previous post? It contains a solution for this. For Lidar Cycle.txt, read in the date as a datetime, the time of day as a duration, and add date and time together.
At the end of my code, I uses synchronize to combine the two timetables, and the plot velocity and distance vs time using yyases..

4 comentarios

Oh my!! Thanks!! It works!!!
Your code didn't work at first, so I thought it wasn't this way, but the GPS Cycle.xlsx file I used(In my computer) and the GPS Cycle.xlsx file I posted in the question were different!
(An error occurred when opening the GPS Cycle.xlsx file in Korean using your code.)
I got it now!! Thanks a lot T.T
I wonder how does the code change if I use the Lidar Cycle file in .txt format instead of Excel format?
Also, using this :
Timeline = xlsread('Timeline.xlsx');
Lidar_DeltaT = Timeline(2, 1);
GPS_DeltaT = Timeline(3, 1);
What code should be added to add time as much as the Delta_T value extracted from the above code?
(Because If the standard time to start measurement is 22:24:43, due to the RTC error, the lidar sensor is taken as recording from 22:24:44 because the time is 1 second faster, and the GPS sensor has a time of 22:24:48 because the time is 5 second faster. This time difference was recorded in a file called Timeline.xlsx. )
There may be some issues with properly identifying columns in a text file vs a spreadsheet, but not usually difficult. It's just a different way to do it.
Also, if I understand correctly, you want to sync your times to by removing 1 second from the Lidar time and 5 seconds from the GPS time. Once you have times as datetime and durations, you can perform normal mathematical operations with them. I would modify by placing the corresponding code at the appropriate places for each data set (before retiming).
GPS.DATE = GPS.DATE - seconds(GPS_DeltaT);
...
Lidar.Time = Lidar.Time - seconds(Lidar_DeltaT);
The seconds function converts the times from Timeline.xlsx to durations (in seconds).
What would be different in the code? when I use the 'Lidar Cycle. txt' instead of 'Lidar Cycle.xlsx'.? And if I want to get the same timetable

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 23 de Ag. de 2020

Comentada:

el 29 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by