![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/221074/image.png)
error using the retime function
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I keep getting an error message when I try to retime my timetable data. I have tried using both linear and nearest interpolation methiods. My time step is only a fraction of a second, that could be a the source of the issue but I have retimed data using small time steps before. I have attached a few lines of my code and the resulting error message.
dt=0.4
Data= timetable
dt=seconds(dt);
Data=unique(Data,'sort','rows');
%FTT = retime(Data, 'regular','nearest','TimeStep',dt);
FTT = retime(Data,'regular','linear','SampleRate',2.3077)
Error using timetable/retime (line 140)
Input timetables must contain unique row times when synchronizing using 'linear'.
0 Commenti
Risposte (1)
Karun Mathiazhagan
il 26 Mag 2019
Hello Emily,
It is my understanding that you are trying to retime a timetable but are encountering an error message relating to non-unique row times.
I used a non-empty timetable in R2019a like in the documented example linked below instead of the empty one (just "timetable") since the empty timetable would throw a different error:
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/221074/image.png)
Link to the example showing the sample timetable TT1: https://www.mathworks.com/help/releases/R2019a/matlab/ref/timetable.retime.html#mw_d15ca4da-a561-45c0-802f-c863b53751b2
However, I had to change TT1 to have repeated time values in the first two entries so as to be able to reproduce the error.
It was then that I noticed that the following command was probably being used to ensure that there were no repeated timestamps.
>> Data = unique(Data,'sort','rows');
If this is the case, kindly note that this command would not achieve this. It would simply make sure that the rows as a whole are unique and not necessarily the timestamp. You would need to extract the "Time" column of the timetable and extract the unique indices first (using "unique") and then use these indices to subscript into "Data".
This would ensure that the timestamps are unique. I hope this helps.
Best,
Karun
0 Commenti
Vedere anche
Categorie
Scopri di più su Timetables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!