Home > matlab > dynatype.m

dynatype

PURPOSE ^

function dynatype (s,var_list)

SYNOPSIS ^

function dynatype (s,var_list)

DESCRIPTION ^

 function dynatype (s,var_list)
 This optional command saves the simulation results in a text file. The name of each 
 variable preceeds the corresponding results. This command must follow SIMUL.
  
 INPUTS
   s:         filename
   var_list:  vector of selected endogenous variables
  
 OUTPUTS
   none

 SPECIAL REQUIREMENTS
   none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dynatype (s,var_list)
0002 % function dynatype (s,var_list)
0003 % This optional command saves the simulation results in a text file. The name of each
0004 % variable preceeds the corresponding results. This command must follow SIMUL.
0005 %
0006 % INPUTS
0007 %   s:         filename
0008 %   var_list:  vector of selected endogenous variables
0009 %
0010 % OUTPUTS
0011 %   none
0012 %
0013 % SPECIAL REQUIREMENTS
0014 %   none
0015 
0016 % Copyright (C) 2001-2009 Dynare Team
0017 %
0018 % This file is part of Dynare.
0019 %
0020 % Dynare is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % Dynare is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 global M_ oo_
0034 
0035 fid=fopen(s,'w') ;
0036 
0037 if size(var_list,1) == 0
0038     var_list = M_.endo_names(1:M_.orig_endo_nbr,:);
0039 end
0040 
0041 n = size(var_list,1);
0042 ivar=zeros(n,1);
0043 for i=1:n
0044     i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
0045     if isempty(i_tmp)
0046         error (['One of the specified variables does not exist']) ;
0047     else
0048         ivar(i) = i_tmp;
0049     end
0050 end
0051 
0052 for i = 1:n
0053     fprintf(fid,M_.endo_names(ivar(i),:),'\n') ;
0054     fprintf(fid,'\n') ;
0055     fprintf(fid,'%15.8g\n',oo_.endo_simul(ivar(i),:)') ;
0056 end
0057 fclose(fid) ;
0058 
0059 return ;

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005