dynare/matlab/ffill.m

42 lines
783 B
Matlab
Raw Normal View History

function [a,b] = ffill(x,ixc,y)
% function [a,b] = ffill(x,ixc,y)
% Makes the horizontale concatenation if x exists
% and fills the matrix with 0 if x and y are not the same size.
%
% INPUTS
% x: matrix
% ixc: vector of indices
% y: matrix
%
% OUTPUTS
% a: concatenation results
% b: vector
%
% SPECIAL REQUIREMENTS
% none
%
% part of DYNARE, copyright Dynare Team (2001-2008)
% Gnu Public License.
xc = size(x,1) ;
if isempty(y)
b = [ixc; 0];
a = [x zeros(size(x,1),1)];
else
yc = size(y,1) ;
b = [ixc;yc] ;
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
end
% 2001/09/1 MJ corrected for absent lags