Class Definition: withtol

datatypes: withtol

Subscript into a timetable by times matched within a tolerance.

A utility class that selects the rows of a timetable whose times fall within a tolerance of the times asked for. It exists because a row time is rarely known to the last microsecond, so asking for one exactly would usually select nothing.

See also: timerange, timetable

Source Code: withtol

The withtol class offers the following public methods:

withtol: wt = withtol (subscriptTimes, tol)

wt = withtol (subscriptTimes, tol) creates a subscript selecting the rows of a timetable whose times are within tol of one of subscriptTimes. The window is closed: a row exactly tol away is selected.

subscriptTimes may be a datetime or duration vector, or text that reads as one. tol must be a nonnegative duration scalar; a bare number is not accepted, there being nothing to say what unit it is in.

The tolerance must be less than half the smallest gap between the times asked for, so that their windows cannot overlap and no row can be selected twice.

See also: timerange, timetable

withtol: ix = rowIndices (wt, rowTimes)

The positions come back grouped by the time that matched them, in the order those times were asked for, rather than in the order the rows are held.