| MATLAB Function Reference | ![]() |
ts = addsample(ts,'Field1',Value1,'Field2',Value2,...)
ts = addsample(ts,s)
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:
'Quality' — Array of data quality codes
'OverwriteFlag' — 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.
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:
s.data
s.time
s.quality
s.overwriteflag
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.
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);delsample, getdatasamplesize, tsprops
![]() | addRequired (inputParser) | addsampletocollection | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |