timetable

Methods

Method Reference: timetable.groupfilter

timetable: G = groupfilter (tt, groupvars, method)
timetable: G = groupfilter (tt, groupvars, method, datavars)
timetable: G = groupfilter (tt, groupvars, groupbins, method, …)
timetable: G = groupfilter (…, 'IncludedEdge', edge)

Keep the rows of a timetable whose group passes a test.

G = groupfilter (tt, groupvars, method) groups the rows of tt by the variables named in groupvars, applies the function handle method to each data variable of each group, and returns the rows of the groups it accepted. method receives the values of one variable across the rows of one group and answers with a logical scalar, keeping or dropping the whole group, or with one logical per row of the group, keeping those rows. The rows that survive keep their order and their row times.

groupvars names one or more variables, or the row dimension name, which groups by the row times themselves.

G = groupfilter (tt, groupvars, method, datavars) applies method only to the variables named in datavars. By default every variable that is not a grouping variable is used, and a row is kept only where every one of them accepts it.

G = groupfilter (tt, groupvars, groupbins, method, …) bins the grouping variables before grouping, groupbins being a bin count, a vector of edges, or a time unit for a datetime or duration variable. The 'IncludedEdge' option then says which edge of a bin is included, 'left' (the default) or 'right'.

A duration is binned by the units that have a fixed length of their own, 'second', 'minute', 'hour', 'day' and 'year'; a week, a month and a quarter have none and are refused. A narrow bin over a wide span asks for more bins than a categorical can name, and the call is refused rather than answered; MATLAB stops at 65536 bins there and returns a grid that does not reach the end of the span.

Source Code: timetable