retime different variable for different methods

2 views (last 30 days)
Suppose I have a table like
Visitor Temperature
Then I want to calculate
  • monthly sum of visitors
  • monthly average of temperature
I see I can write to retime one for @sum and one for @mean. But is it possible to have one retime and have @sum for Visitor variable and @mean for Temperature variable?

Accepted Answer

Steven Lord
Steven Lord on 19 Jun 2022
Looking at the documentation page for the retime function, the description of the method input argument states that it must be "specified as a character vector, string scalar, or function handle." It cannot be specified as a cell array of either character vectors or function handles or a string array, which is likely how it would need to be specified to use different methods for different data variables.
See the "Apply Multiple Methods to Timetable" example on that documentation page for a model you can use for your retime calls and how to reassemble the data into one timetable afterwards.
Steven Lord
Steven Lord on 21 Jun 2022
No, you can't do that with one retime call.

Sign in to comment.

More Answers (0)


Find more on Tables in Help Center and File Exchange





Community Treasure Hunt

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

Start Hunting!

Translated by