diff --git a/matlab/annualized_shock_decomposition.m b/matlab/annualized_shock_decomposition.m
index 72591634dba31be8d3d629078b25a6211dfb9d5e..8d6ae2d48ce7409330015eea0611bc21b7b29fd8 100644
--- a/matlab/annualized_shock_decomposition.m
+++ b/matlab/annualized_shock_decomposition.m
@@ -120,6 +120,7 @@ elseif q2a.plot ~= 2
 end
 
 % end initialize names
+steady_state=steady_state(i_var);
 
 if realtime_==0
     % usual shock decomp
@@ -143,7 +144,6 @@ if isstruct(aux)
         aux.yss=steady_state_aux;
     end
 end
-steady_state=steady_state(i_var);
 % endo_names = M_.endo_names(i_var,:);
 % endo_names_tex = M_.endo_names_tex(i_var,:);
 
@@ -330,4 +330,4 @@ elseif q2a.plot == 2
     z=za;
 else
     z=cat(1,za,gza);
-end
\ No newline at end of file
+end