%% Create Three Financial Time Series Objects and Merge into a Single Object
% Create three financial time series objects and merged into a new time series object t123.

dates = {'jan-01-2001'; 'jan-02-2001'; 'jan-03-2001'; ...
         'jan-04-2001'; 'jan-06-2001'};
data = [1; 1; 1; 1; 1];
t1 = fints(dates, data);

dates = {'jan-02-2001'; 'jan-03-2001'; 'jan-04-2001';
         'jan-05-2001'};
data = [2; 2; 2; 2];
t2 = fints(dates, data);

dates = {'jan-03-2001'; 'jan-04-2001'; 'jan-05-2001'; 
         'jan-06-2001'};
data = [3; 3; 3; 3];
t3 = fints(dates, data);

t123 = merge(t1, t2, t3)

%
% If you change the order of input time series, the output may contain different data when duplicate dates exist. Here, for example, is the result of using the same three time series defined above but with the order changed.

merge(t3, t2, t1)

% t123 contains all 1's except on '05-Jan-2001' because t1 appears first in the list of inputs and takes precedence. The same logic can be applied to t321. By changing the order of inputs, you can overwrite old financial time series data with new data by placing the new time series ahead of the old one in the list of inputs to the merge function.
% Copyright 2015 The MathWorks, Inc.