retime Linear or next

4 vues (au cours des 30 derniers jours)
Greg LANGE
Greg LANGE le 2 Déc 2022
Modifié(e) : Star Strider le 7 Déc 2022
I tried to retime my dataset every 10 minutes and I am tying to have it as minutes with Linear (for temperature).
TT2=retime(table_intermediaire,'minutes', linear');
I does works for me as it displays :
"Check for incorrect argument data type or missing argument in call to
function 'retime'."
What would be the command for => minutes and next for the same datasets ?

Réponses (2)

Star Strider
Star Strider le 2 Déc 2022
Modifié(e) : Star Strider le 7 Déc 2022
Try something like this —
Time = datetime('now')+hours(0:2).';
Temperature = 10*randn(size(Time));
T2 = table(Time,Temperature); % Create 'table'
TT2 = table2timetable(T2) % Create 'timetable'
TT2 = 3×1 timetable
Time Temperature ____________________ ___________ 07-Dec-2022 22:16:11 16.281 07-Dec-2022 23:16:11 4.817 08-Dec-2022 00:16:11 14.605
TT2r = retime(TT2,'regular', 'linear', 'TimeStep',minutes(10)) % Use 'retime'
TT2r = 14×1 timetable
Time Temperature ____________________ ___________ 07-Dec-2022 22:10:00 17.465 07-Dec-2022 22:20:00 15.554 07-Dec-2022 22:30:00 13.644 07-Dec-2022 22:40:00 11.733 07-Dec-2022 22:50:00 9.8224 07-Dec-2022 23:00:00 7.9117 07-Dec-2022 23:10:00 6.001 07-Dec-2022 23:20:00 5.4373 07-Dec-2022 23:30:00 7.0686 07-Dec-2022 23:40:00 8.6999 07-Dec-2022 23:50:00 10.331 08-Dec-2022 00:00:00 11.962 08-Dec-2022 00:10:00 13.594 08-Dec-2022 00:20:00 15.225
See the documentation section on Specify Time Step of Your Own for details.
EDIT — (7 Dec 2022 at 22:16)
The ‘datasets.mat’ file posted later and I didn’t see the update.
LD = load(websave('datasets','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1216727/datasets.mat'));
table_intermediaire = LD.table_intermediaire
table_intermediaire = 7×2 table
DATE T_VApt01 ___________________ ________ 30/11/2018 00:00:00 35 30/11/2018 00:10:00 32 30/11/2018 00:20:00 20 30/11/2018 00:30:00 0 30/11/2018 00:40:00 20 30/11/2018 00:50:00 30 30/11/2018 01:00:00 0
timetable_intermediaire = table2timetable(table_intermediaire);
timetable_intermediairer = retime(timetable_intermediaire,'regular', 'linear', 'TimeStep',minutes(1)) % Use 'retime'
timetable_intermediairer = 61×1 timetable
DATE T_VApt01 ___________________ ________ 30/11/2018 00:00:00 35 30/11/2018 00:01:00 34.7 30/11/2018 00:02:00 34.4 30/11/2018 00:03:00 34.1 30/11/2018 00:04:00 33.8 30/11/2018 00:05:00 33.5 30/11/2018 00:06:00 33.2 30/11/2018 00:07:00 32.9 30/11/2018 00:08:00 32.6 30/11/2018 00:09:00 32.3 30/11/2018 00:10:00 32 30/11/2018 00:11:00 30.8 30/11/2018 00:12:00 29.6 30/11/2018 00:13:00 28.4 30/11/2018 00:14:00 27.2 30/11/2018 00:15:00 26
.

Seth Furman
Seth Furman le 7 Déc 2022
I should add that if you wanted the new time step to be one minute, then you would want "minutely" instead of "minutes".
load datasets.mat
tt = table2timetable(table_intermediaire)
tt = 7×1 timetable
DATE T_VApt01 ___________________ ________ 30/11/2018 00:00:00 35 30/11/2018 00:10:00 32 30/11/2018 00:20:00 20 30/11/2018 00:30:00 0 30/11/2018 00:40:00 20 30/11/2018 00:50:00 30 30/11/2018 01:00:00 0
retime(tt,"minutely","linear")
ans = 61×1 timetable
DATE T_VApt01 ___________________ ________ 30/11/2018 00:00:00 35 30/11/2018 00:01:00 34.7 30/11/2018 00:02:00 34.4 30/11/2018 00:03:00 34.1 30/11/2018 00:04:00 33.8 30/11/2018 00:05:00 33.5 30/11/2018 00:06:00 33.2 30/11/2018 00:07:00 32.9 30/11/2018 00:08:00 32.6 30/11/2018 00:09:00 32.3 30/11/2018 00:10:00 32 30/11/2018 00:11:00 30.8 30/11/2018 00:12:00 29.6 30/11/2018 00:13:00 28.4 30/11/2018 00:14:00 27.2 30/11/2018 00:15:00 26

Catégories

En savoir plus sur Timetables dans Help Center et File Exchange

Tags

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by