Creating Timetable from Excel for Driving Cycle.
Afficher commentaires plus anciens
I would like to create a timetable for the driving cycle using the above two excel files.
I want to extract the speed data per second from the GPS Cycle excel file,
I want to extract Distance data per second from Lidar Cycle Excel file.
I want to write these two data in a timetable per second and make a graph.
Unfortunately, GPS data is well recorded per second, but Lidar Distance data per second is sometimes missed by 2 seconds.
Ex) 2020.06.25 15:21:23 Distance = 1533 -> 2020.06.25 15:21:25 Distance = 1344 (No 2020.06.25 15:21:24 Data)
I want to process this Missing Data as well.
I want to give the missing Lidar Distance Data a value of 0.
I don't get a sense of which method to use.
Please help.
2 commentaires
Cris LaPierre
le 22 Août 2020
What have you tired so far?
Jingyu Yang
le 22 Août 2020
Réponse acceptée
Plus de réponses (1)
Cris LaPierre
le 22 Août 2020
Try something like this.
% Get speed data (from Adam)
opts = detectImportOptions('GPS Cycle.xlsx');
opts.VariableTypes = {'double','datetime','double','double','double','double','double','double','double'};
GPS = readtimetable('GPS Cycle.xlsx',opts);
GPS = retime(GPS,"secondly","fillwithconstant","Constant",0);
% Get distance
opts = detectImportOptions('Lidar Cycle.xlsx');
opts.VariableNames = ["Var1", "Var2", "DATE", "Var4", "Day", "Var6", "Time", "Var8", "Var9", "Var10", "Distance", "Unit"];
opts.SelectedVariableNames = ["DATE", "Time", "Distance"];
opts.VariableTypes = ["categorical", "char", "datetime", "char", "categorical", "char", "duration", "char", "categorical", "char", "double", "categorical"];
opts = setvaropts(opts,"Time","DurationFormat","hh:mm:ss.S");
Lidar = readtimetable('Lidar Cycle.xlsx',opts);
Lidar.DATE = Lidar.DATE + Lidar.Time;
Lidar = retime(Lidar,"secondly","fillwithconstant","Constant",0);
Lidar = removevars(Lidar,"Time");
% merge the GPS and Lidar data
comb = synchronize(GPS,Lidar)
% Create plot
yyaxis left
plot(comb.DATE,comb.Distance)
ylabel("Distance (cm)")
yyaxis right
plot(comb.DATE,comb.Velocity_km_h_)
ylabel("Velocity (km/h)")
xlabel("Time (hh:mm:ss)")
xtickformat("hh:mm:ss")
1 commentaire
+1
@Jingyu Yang this answer more completely addresses your questions. Consider accepting this one instead.
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!