Incorrect datatype when using 'retime' function

1 view (last 30 days)
Ieuan Price-davies
Ieuan Price-davies on 15 Oct 2021
Answered: Star Strider on 15 Oct 2021
I'm designing a model for a windturbine. The model calcualtes power generated everyhour. I'm trying to use the retime function to sum thos data and produce daily totals.
windtest is a table of results that looks like this:
windtest =
73×4 table
Date WindSpeed PowerOutput PowerOutputKw
____________ _________ ___________ _____________
10.02. 00:00 3.8 34.21 0.03421
10.02. 01:00 3.1 18.573 0.018573
10.02. 02:00 4 39.901 0.039901
10.02. 03:00 3.6 29.088 0.029088
10.02. 04:00 3.5 26.73 0.02673
10.02. 05:00 4 39.901 0.039901
10.02. 06:00 4.1 42.969 0.042969
10.02. 07:00 3.5 26.73 0.02673
10.02. 08:00 4.3 49.569 0.049569
10.02. 09:00 4.9 73.348 0.073348
10.02. 10:00 4.5 56.812 0.056812
10.02. 11:00 4.3 49.569 0.049569
10.02. 12:00 4.7 64.728 0.064728
10.02. 13:00 4.7 64.728 0.064728
10.02. 14:00 4.5 56.812 0.056812
10.02. 15:00 5.2 87.662 0.087662
10.02. 16:00 4.9 73.348 0.073348
10.02. 17:00 4.7 64.728 0.064728
10.02. 18:00 4.5 56.812 0.056812
10.02. 19:00 4.1 42.969 0.042969
10.02. 20:00 3.6 29.088 0.029088
10.02. 21:00 4 39.901 0.039901
10.02. 22:00 3.8 34.21 0.03421
10.02. 23:00 4 39.901 0.039901
11.02. 00:00 4 39.901 0.039901
11.02. 01:00 4.1 42.969 0.042969
11.02. 02:00 3.8 34.21 0.03421
11.02. 03:00 4 39.901 0.039901
11.02. 04:00 3.5 26.73 0.02673
11.02. 05:00 3.3 22.405 0.022405
11.02. 06:00 3.5 26.73 0.02673
11.02. 07:00 3.8 34.21 0.03421
11.02. 08:00 4.1 42.969 0.042969
11.02. 09:00 4.7 64.728 0.064728
11.02. 10:00 4.9 73.348 0.073348
11.02. 11:00 4.7 64.728 0.064728
11.02. 12:00 5.2 87.662 0.087662
11.02. 13:00 5.9 128.04 0.12804
11.02. 14:00 5.7 115.46 0.11546
11.02. 15:00 5.4 98.171 0.098171
11.02. 16:00 5.7 115.46 0.11546
11.02. 17:00 5.7 115.46 0.11546
11.02. 18:00 6.7 187.51 0.18751
11.02. 19:00 4.5 56.812 0.056812
I'm then summing the PowerOutputcolumn according to the day using retime:
BOS = windtest(:, 'PowerOutput');
powerperday2 = retime(BOS,'daily','sum');
However when I run this I get the following error:
Check for missing argument or incorrect argument data type in call to function 'retime'.
Error in WindTurbine (line 42)
powerperday2 = retime(BOS,'daily','sum');
I think i've followed the documentation properly, but cannot find another example of this error online - if anyone could help poiunt out where I'm going wrong it would be greatly appreciated.
Cheers,
I x

Answers (1)

Star Strider
Star Strider on 15 Oct 2021
The retime function works only with timetable arrays, to the best of my knowledge. See if using the table2timetable funciton first will eventually produce the desired result.
.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by