retime function not working

11 Ansichten (letzte 30 Tage)
Lara Zlateva
Lara Zlateva am 30 Nov. 2019
Kommentiert: Lara Zlateva am 1 Dez. 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

Akzeptierte Antwort

Steven Lord
Steven Lord am 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 Kommentar
Lara Zlateva
Lara Zlateva am 1 Dez. 2019
You're right! I guess I should create a seperate timetable for each column I want to use. Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Variables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by