timetable retime error - input timetable must contain unique row times

30 views (last 30 days)
Hi all,
I'm having difficulties undertanding the error code that i am getting.
using the code as stated below, i am trying to retime the timetable value for every 15 minutes.
timetable = unique(timetable)
dt = minutes(15);
timetable = retime(timetable,'regular','linear','TimeStep',dt);
The timetable looks as displayed below...
The error code that i am getting is as following:
"Error using timetable/retime (line 140)
Input timetables must contain unique row times when synchronizing using 'linear'."
What may be the problem here, and how may i solve it?
thank you.

Accepted Answer

Steven Lord
Steven Lord on 29 Sep 2020
First, don't name a variable timetable. That already has a meaning in MATLAB.
Second, at least two rows of your timetable (which I'm going to call TT) have the same value for their RowTimes.
X = TT.Properties.RowTimes;
any(X(1:end-1) == X(2:end)) % likely returns true
Suppose I had two vectors:
v1 = [1:5 5:10];
v2 = 1:numel(v1);
plot(v1, v2, 'o-')
If I wanted to interpolate THE value of v2 when v1 = 5, what should that ONE value be? 5, 6, 5.5, NaN (since it's not unique), etc.?
How you fix that problem will depend on your specific data and the problem you're trying to solve.
  2 Comments
Sehoon Chang
Sehoon Chang on 29 Sep 2020
Hi Steven,
thanks for your reply.
I do see that I have identical value within the variable, and that is causing the error.
How may i proceed without deleting all identical data?
BR
Steven Lord
Steven Lord on 29 Sep 2020
Take the first row in the timetable with the same date and time data?
Take the last row in the timetable with the same date and time data?
Take the mean along the variables of the rows in the timetable with the same date and time data?
Take the min or max value of each variable of the rows in the timetable with the same date and time data?
It really depends what the data represents. One could probably come up with scenarios where each of those would be appropriate. One such scenario involves multiple simultaneous bank transactions being posted to your account, especially if you have automatic bill paying enabled. Which account balance will your bank use to determine if it should charge you an overdraft fee?

Sign in to comment.

More Answers (0)

Categories

Find more on Timetables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!