error using the retime function
조회 수: 11 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Karun Mathiazhagan
2019년 5월 26일
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:
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!