addsample - Add data sample to timeseries object

Syntax

ts = addsample(ts,'Field1',Value1,'Field2',Value2,...)
ts = addsample(ts,s)

Description

ts = addsample(ts,'Field1',Value1,'Field2',Value2,...) adds one or more data samples to the timeseries object ts, where one field must specify Time and another must specify Data. You can also specify the following optional property-value pairs:

ts = addsample(ts,s) adds one or more new samples stored in a structure s to the timeseries object ts. You must define the fields of the structure s before passing it as an argument to addsample by assigning values to the following optional s fields:

Remarks

A time-series data sample consists of one or more values recorded at a specific time. The number of data samples in a time series is the same as the length of the time vector.

The Time value must be a valid time vector.

Suppose that N is the number of samples. The sample size of each time series is given by SampleSize = getsamplesize(ts). When ts.IsTimeFirst is true, the size of the data is N-by-SampleSize. When ts.IsTimeFirst is false, the size of the data is SampleSize-by-N.

Examples

Add a data value of 420 at time 3.

ts = ts.addsample('Time',3,'Data',420);

Add a data value of 420 at time 3 and specify quality code 1 for this data value. Set the flag to overwrite an existing value at time 3.

ts = ts.addsample('Data',3.2,'Quality',1,'OverwriteFlag',... 
        true,'Time',3);

See Also

delsample, getdatasamplesize, tsprops

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS