Bug fix for provisions in shock_decomposition.m to adapt for the new syntax on grouping shocks introduced in commit 804d31e8af to close #1280

time-shift
Marco Ratto 2016-09-22 18:41:33 +02:00
parent 99d7b2b8b2
commit fe7b7819b0
1 changed files with 8 additions and 4 deletions

View File

@ -116,11 +116,15 @@ oo_.shock_decomposition = z;
if options_.use_shock_groups
shock_groups = M_.shock_groups.(options_.use_shock_groups);
shock_names = fieldnames(shock_groups);
ngroups = length(shock_names);
shock_ind = fieldnames(shock_groups);
ngroups = length(shock_ind);
shock_names = shock_ind;
for i=1:ngroups,
shock_names{i} = (shock_groups.(shock_ind{i}).label);
end
zz = zeros(endo_nbr,ngroups+2,gend);
for i=1:length(shock_names)
for j = shock_groups.(shock_names{i})
for i=1:ngroups
for j = shock_groups.(shock_ind{i}).shocks
k = find(strcmp(j,cellstr(M_.exo_names)));
zz(:,i,:) = zz(:,i,:) + z(:,k,:);
end