Add data sample to timeseries object
ts1 = addsample(ts, s)
ts1 = addsample(ts, 'Data', data-value, 'Time',time-value,..., Name,Value)
ts1 = addsample(ts, 'Data', data-value, 'Time',time-value,..., Name,Value) adds one or more data samples to the timeseries object ts along with additional options specified by one or more Name,Value pair arguments.
If N is the number of data samples, you can get the sample size of each time with 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.
A structure that you must define before passing as an argument to addsample. It consists of the following optional fields:
A numeric data value.
A valid time vector.
Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
Array of data quality codes.
Logical value that controls whether to overwrite a data sample at the same time with the new sample you are adding to your timeseries object. When set to true, the new sample overwrites the old sample at the same time.
The timeseries object that results when you add the specified samples to the original timeseries object.
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.
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 OverwriteFlag to overwrite an existing value at time 3.
ts = ts.addsample('Data',3.2,'Quality',1,'OverwriteFlag',... true,'Time',3);