2005-02-18 20:54:39 +01:00
|
|
|
function [a,b] = ffill(x,ixc,y)
|
2008-01-28 15:28:06 +01:00
|
|
|
% function [a,b] = ffill(x,ixc,y)
|
2008-08-01 14:40:33 +02:00
|
|
|
% Makes the horizontal concatenation if x exists
|
2008-01-28 15:28:06 +01:00
|
|
|
% and fills the matrix with 0 if x and y are not the same size.
|
|
|
|
%
|
|
|
|
% INPUTS
|
|
|
|
% x: matrix
|
|
|
|
% ixc: vector of indices
|
|
|
|
% y: matrix
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
2008-01-28 15:28:06 +01:00
|
|
|
% OUTPUTS
|
|
|
|
% a: concatenation results
|
|
|
|
% b: vector
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
2008-01-28 15:28:06 +01:00
|
|
|
% SPECIAL REQUIREMENTS
|
|
|
|
% none
|
|
|
|
|
2022-04-13 13:15:19 +02:00
|
|
|
% Copyright © 2001-2017 Dynare Team
|
2008-08-01 14:40:33 +02:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2008-01-28 15:28:06 +01:00
|
|
|
|
2005-02-18 20:54:39 +01:00
|
|
|
xc = size(x,1) ;
|
|
|
|
|
|
|
|
if isempty(y)
|
2009-12-16 18:17:34 +01:00
|
|
|
b = [ixc; 0];
|
|
|
|
a = [x zeros(size(x,1),1)];
|
2005-02-18 20:54:39 +01:00
|
|
|
else
|
2009-12-16 18:17:34 +01:00
|
|
|
yc = size(y,1) ;
|
|
|
|
b = [ixc;yc] ;
|
2005-02-18 20:54:39 +01:00
|
|
|
|
2009-12-16 18:17:34 +01:00
|
|
|
if xc > yc
|
|
|
|
a = [x [y;zeros(xc-yc,size(y,2))]] ;
|
|
|
|
elseif yc > xc
|
|
|
|
a = [[x;zeros(yc-xc,size(x,2))] y] ;
|
|
|
|
else
|
|
|
|
a = [x y] ;
|
|
|
|
end
|
2005-02-18 20:54:39 +01:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
% 2001/09/1 MJ corrected for absent lags
|