Class Definition: rowfilter

datatypes: rowfilter

Subscript into a table or timetable by a condition on its variables.

A utility class that builds a condition out of comparisons written against variable names, and selects the rows satisfying it. The condition is written before the rows are looked at, so the same filter may be used on any table naming the same variables.

 
 rf = rowfilter (tbl);
 tbl(rf.Height > 180 & rf.Age < 40, :)

A filter of this package is a rowfilter, a class of its own beside vartype, timerange and withtol, where MATLAB’s is a matlab.io.RowFilter. Only the class name differs: nothing here calls itself matlab.*, and no behaviour follows from it.

See also: timerange, withtol, table, timetable

Source Code: rowfilter

The rowfilter class offers the following public methods:

rowfilter: rf = rowfilter (tbl)
rowfilter: rf = rowfilter (varNames)

rf = rowfilter (tbl) creates a filter that may be written against the variables of tbl, a table or a timetable. For a timetable the row times may be filtered on too, under the name of the row dimension.

rf = rowfilter (varNames) creates one against the named variables without a table to take them from, so that a filter may be written before the data it will be applied to exists.

A filter carries no condition until one is written against it, and a condition is a comparison of a variable with a value, optionally combined with &, | and ~.

See also: timerange, withtol, table, timetable

rowfilter: ix = rowIndices (rf, tbl)