retime function not working

14 次查看(过去 30 天)
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

采纳的回答

Steven Lord
Steven Lord 2019-11-30
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 个评论
Lara Zlateva
Lara Zlateva 2019-12-1
You're right! I guess I should create a seperate timetable for each column I want to use. Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by