MATLAB Answers

retime function not working

2 ビュー (過去 30 日間)
Lara Zlateva
Lara Zlateva 2019 年 11 月 30 日
Commented: Lara Zlateva 2019 年 12 月 1 日
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

  0 件のコメント

サインイン to comment.

採用された回答

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!

サインイン to comment.

More Answers (0)

サインイン してこの質問に回答します。


Translated by