diff --git a/matlab/@dynSeries/horzcat.m b/matlab/@dynSeries/horzcat.m
index 0a47a6814..0acbebdfc 100644
--- a/matlab/@dynSeries/horzcat.m
+++ b/matlab/@dynSeries/horzcat.m
@@ -1,15 +1,15 @@
-function a = horzcat(b,c)
+function a = horzcat(varargin)
%@info:
-%! @deftypefn {Function file} {@var{a} =} horzcat (@var{b},@var{c})
+%! @deftypefn {Function file} {@var{a} =} horzcat (@var{b},@var{c}, ...)
%! @anchor{horzcat}
%! @sp 1
%! Method of the dynSeries class.
%! @sp 1
-%! Merge two Dynare time series class. This method overloads the horizontal concatenation operator, so that
-%! two time series objects can be merged using the following syntax
+%! Merge Dynare time series objects. This method overloads the horizontal concatenation operator, so that
+%! two (or more) time series objects can be merged using the following syntax:
%!
-%! a = [b, c];
+%! a = [b, c, d];
%! @sp 2
%! @strong{Inputs}
%! @sp 1
@@ -31,7 +31,7 @@ function a = horzcat(b,c)
%! @ref{descriptive_statistics}
%!
%! @strong{This function calls:}
-%! @ref{dynSeries}
+%! @ref{dynSeries}, @ref{private/horzcat2}
%!
%! @strong{Remark 1.} It is assumed that the two time series objects have the same frequencies. The two time series objects can cover
%! different time ranges.
@@ -57,97 +57,19 @@ function a = horzcat(b,c)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-if ~isa(b,'dynSeries')
- error('dynSeries::horzcat: First input argument has to be a Dynare time series object!')
+if nargin==0 || nargin==1
+ error('dynSeries::horzcat: I need at least two input arguments!')
end
-if ~isa(c,'dynSeries')
- error('dynSeries::horzcat: Second input argument has to be a Dynare time series object!')
-end
-
-if b.freq ~= c.freq
- error('dynSeries::horzcat: Two time series objects must have common frequency!')
+if nargin==2
+ a = horzcat2(varargin{1},varargin{2});
else
- a = dynSeries();
- a.freq = b.freq;
-end
-
-d_nobs_flag = 0;
-if b.nobs ~= c.nobs
- % error('dynSeries::horzcat: Two time series objects must have the same number of observations!')
- d_nobs_flag = 1;
-else
- a.nobs = b.nobs;
-end
-
-d_init_flag = 0;
-if isequal(b.init,c.init)
- a.init = b.init;
-else
- % error('dynSeries:: Two time series objects must have common initial date!')
- % set a.init equal to min(b.init,c.init)
- if b.init(1)