retime function not working

4 visualizzazioni (ultimi 30 giorni)
Lara Zlateva
Lara Zlateva il 30 Nov 2019
Commentato: Lara Zlateva il 1 Dic 2019
Hi,
I have a large timetable with information on daily temperatures in a town from 1977 to 2016. I am trying to get the mean, max and min temperatures of each month.However, when I try to use the retime function, I get the error message "Undefined function 'retime' for input arguments of type 'double'."
Here is my code up until now:
t=readtable('scottdata.xlsx', 'readvariablenames', true);
dt = datetime(Year, Month, Day);
tt = table2timetable(t(2:14611, :), 'rowtimes', dt);
monthly_mean = retime(MeanTempC, 'monthly', 'mean');
And here is an extract from the timetable (it also includes NaN values which show up as empty vectors, maybe this is where the problem sems from?) . The fourth column is MeanTempC :
01-Jan-1977 {'1977'} {'1'} {'1'} {'-2.8'} {0×0 char} {'-20.6'} {0×0 char} {'-11.7'}
02-Jan-1977 {'1977'} {'1'} {'2'} {'-5' } {0×0 char} {'-10' } {0×0 char} {'-7.5' }
Thank you for your help

Risposta accettata

Steven Lord
Steven Lord il 30 Nov 2019
The variable tt is a timetable, but is MeanTempC? Nowhere in your code do you define it, but from the error I would guess it is a double array, not a timetable. retime is only defined for timetable first inputs.
  1 Commento
Lara Zlateva
Lara Zlateva il 1 Dic 2019
You're right! I guess I should create a seperate timetable for each column I want to use. Thank you!

Accedi per commentare.

Più risposte (0)

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!

Translated by