


function [z,zss]=dyn2vec(s1,s2)
Takes Dynare variables from oo_.endo_simul and copies them into matlab global vectors
INPUTS
s1: subset of variables to be saved
s2: optional parameter, copies Dynare variables (s1) in matlab ones (s2)
OUTPUTS
z: subset of oo_.endo_simul
zss: matrix of variables in steady state
SPECIAL REQUIREMENTS
none

0001 function [z,zss]=dyn2vec(s1,s2) 0002 % function [z,zss]=dyn2vec(s1,s2) 0003 % Takes Dynare variables from oo_.endo_simul and copies them into matlab global vectors 0004 % 0005 % INPUTS 0006 % s1: subset of variables to be saved 0007 % s2: optional parameter, copies Dynare variables (s1) in matlab ones (s2) 0008 % 0009 % OUTPUTS 0010 % z: subset of oo_.endo_simul 0011 % zss: matrix of variables in steady state 0012 % 0013 % SPECIAL REQUIREMENTS 0014 % none 0015 % 0016 0017 % Copyright (C) 2001-2009 Dynare Team 0018 % 0019 % This file is part of Dynare. 0020 % 0021 % Dynare is free software: you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published by 0023 % the Free Software Foundation, either version 3 of the License, or 0024 % (at your option) any later version. 0025 % 0026 % Dynare is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0029 % GNU General Public License for more details. 0030 % 0031 % You should have received a copy of the GNU General Public License 0032 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0033 0034 global M_ oo_ options_ 0035 0036 if options_.smpl == 0 0037 k = [1:size(oo_.endo_simul,2)]; 0038 else 0039 k = [M_.maximum_lag+options_.smpl(1):M_.maximum_lag+options_.smpl(2)]; 0040 end 0041 0042 if nargin == 0 0043 if nargout > 0 0044 t = ['DYNARE dyn2vec error: the function doesn''t return values when' ... 0045 ' used without input argument']; 0046 error(t); 0047 end 0048 for i=1:size(oo_.endo_simul,1) 0049 assignin('base',deblank(M_.endo_names(i,:)),oo_.endo_simul(i,k)'); 0050 end 0051 return 0052 else 0053 j = strmatch(s1,M_.endo_names,'exact'); 0054 if ~ isempty(j) 0055 z = oo_.endo_simul(j,k)'; 0056 else 0057 j = strmatch(s1,M_.exo_names,'exact'); 0058 if ~ isempty(j) 0059 if options_.smpl == 0 0060 z = oo_.exo_simul(:,j); 0061 else 0062 z = oo_.exo_simul(M_.maximum_lag+options_.smpl(1):M_.maximum_lag+options_.smpl(2)); 0063 end 0064 else 0065 t = ['DYNARE dyn2vec error: variable ' deblank(s1(i,:)) ' doesn''t' ... 0066 ' exist.'] ; 0067 error (t) ; 0068 end 0069 end 0070 end 0071 0072 if nargout == 0 0073 if nargin == 1 0074 assignin('base',s1,z); 0075 elseif nargin == 2 0076 assignin('base',s2,z); 0077 end 0078 else 0079 zss=oo_.steady_state(j); 0080 end 0081 0082 % 02/23/01 MJ redone, incorporating FC's improvements 0083 % 08/24/01 MJ replaced globlize by internal assignin 0084 % 08/24/01 MJ added 'exact' to strmatch (thanks to David Vavra) 0085 % 01/31/03 MJ added provision for alternative name of variable 0086 0087 0088