getdatasamples
Picks samples of a timeseries by index and returns only the data.
Category: Language Fundamentals > Data Types
Syntax
d = getdatasamples(ts, idx)
Returns the data rows at the sample indices idx.
Description
getdatasamples is the data-only counterpart of getsamples: it returns the numbers at those sample positions without time information. Indexing is by sample number, not by time value.
Input arguments
tstimeseriesobject.idx- Vector of sample indices.
Output arguments
d- Array with the selected data samples (not a timeseries).
Example
Samples 1 and 3
ts = timeseries([10; 20; 30; 40], [0; 1; 2; 3]);
d = getdatasamples(ts, [1 3])
Output
d = 2×1
10
30
See also
getsamples timeseries getsampleusingtime getdatasamplesize addsample