diff --git a/matlab/DsgeLikelihood.m b/matlab/DsgeLikelihood.m index a34d264ae..8ff1f8751 100644 --- a/matlab/DsgeLikelihood.m +++ b/matlab/DsgeLikelihood.m @@ -116,7 +116,7 @@ function [fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); t = options_.trend_coeffs; - for i=1:nobs + for i=1:length(t) if ~isempty(t{i}) trend_coeff(i) = evalin('base',t{i}); end diff --git a/matlab/DsgeLikelihood_hh.m b/matlab/DsgeLikelihood_hh.m index bc7f8c795..a5ec7ebc4 100644 --- a/matlab/DsgeLikelihood_hh.m +++ b/matlab/DsgeLikelihood_hh.m @@ -122,7 +122,7 @@ function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); t = options_.trend_coeffs; - for i=1:nobs + for i=1:length(t) if ~isempty(t{i}) trend_coeff(i) = evalin('base',t{i}); end diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index c765fac90..7f7d03a88 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -52,7 +52,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R] = Dsge if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); t = options_.trend_coeffs; - for i=1:nobs + for i=1:length(t) if ~isempty(t{i}) trend_coeff(i) = evalin('base',t{i}); end