Skip to content
Snippets Groups Projects
Commit cd4bfdcf authored by Houtan Bastani's avatar Houtan Bastani Committed by Stéphane Adjemian
Browse files

fix bug when concatenating series that don’t overlap. closes #17

parent 41d10eb1
Branches
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ function B = horzcat(varargin) % --*-- Unitary tests --*--
% REMARKS
% o A1, A2, ... must not have common variables.
% Copyright (C) 2011-2013 Dynare Team
% Copyright (C) 2011-2017 Dynare Team
%
% This file is part of Dynare.
%
......@@ -97,8 +97,23 @@ function a = concatenate(b,c)
elseif b_last_date>c_last_date
c.data = [c.data; NaN(b_last_date-c_last_date, vobs(c))];
end
fillerdates = dates();
if max(c.dates) < min(b.dates)
fillerdates = max(c.dates):min(b.dates);
end
if max(b.dates) < min(c.dates)
fillerdates = max(b.dates):min(c.dates);
end
if isempty(fillerdates)
hd = [b.dates, c.dates];
else
hd = [b.dates, fillerdates, c.dates];
end
a.data = [b.data, c.data];
a.dates = sort(unique([b.dates, c.dates]));
a.dates = sort(unique(hd));
end
%@test:1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment