tscollection

Methods

Method Reference: tscollection.addsampletocollection

tscollection: tc = addsampletocollection (tc, 'Time', time, name1, data1, …)

Add samples to every member.

tc = addsampletocollection (tc, 'Time', time, name1, data1, …) inserts samples at the times time, keeping the collection in time order; a sample at a time already present goes after the samples there. The member name1, its exact name, takes the samples data1, one per time, read against time as the timeseries constructor reads data against times and each of the size of the member’s samples. A member not named takes NaN, or 0 for integer data and false for logical data. 'Time' is matched in any case.

For a collection with no TimeInfo.StartDate time is numbers in its units; for one with a start date it may also be dates as text, or a datetime. A member with quality codes gives each new sample the code of the sample nearest in time, the later one on a tie, as MATLAB does.

See also: tscollection.delsamplefromcollection, timeseries.addsample

Source Code: tscollection

New samples go in time order. A member not given data takes NaN there, or 0 for integer data and false for logical data.

 tc = tscollection ({timeseries([1; 3], [0; 2], 'Name', 'a'), ...
                     timeseries([10; 30], [0; 2], 'Name', 'b')});
 tc = addsampletocollection (tc, 'Time', 1, 'a', 2);
 [tc.Time, tc.a.Data, tc.b.Data]
ans =

     0     1    10
     1     2   NaN
     2     3    30