timeseries

Methods

Method Reference: timeseries.getsamples

timeseries: ts2 = getsamples (ts, ind)

Return a series of selected samples.

ts2 = getsamples (ts, ind) returns the series ts holding only the samples ind, which are taken in time order whatever order they are given in, repeats included. ind is as for getdatasamples. Their times and quality codes go with them, and every other property is kept.

MATLAB names the result 'unnamed', and for an empty ind returns timeseries () with every property reset; here the name and properties are kept in both cases.

See also: timeseries.getdatasamples, timeseries.getsampleusingtime, timeseries.delsample

Source Code: timeseries

getsamples returns a series of the samples asked for, in time order, with their times and quality codes. A logical mask works too.

 ts = timeseries ([10; 20; 30; 40], [0; 1; 2; 3], [1; 1; 0; 1]);
 [ts.Time, ts.Data, ts.Quality]
ans =

    0   10    1
    1   20    1
    2   30    0
    3   40    1
 s = getsamples (ts, [3, 1]);
 [s.Time, s.Data, s.Quality]
ans =

    0   10    1
    2   30    0
 s = getsamples (ts, ts.Data > 15);
 [s.Time, s.Data]
ans =

    1   20
    2   30
    3   40