Home > . > datatomfile.m

datatomfile

PURPOSE ^

Copyright (C) 2001 Michel Juillard

SYNOPSIS ^

function datatomfile (s,var_list)

DESCRIPTION ^

 Copyright (C) 2001 Michel Juillard

 DYNATYPE :    DYNATYPE ( [ 'filename' ] )
        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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Copyright (C) 2001 Michel Juillard
0002 %
0003 function datatomfile (s,var_list)
0004 % DYNATYPE :    DYNATYPE ( [ 'filename' ] )
0005 %        This optional command saves the simulation
0006 %        results in a text file. The name of each
0007 %        variable preceeds the corresponding results.
0008 %        This command must follow SIMUL.
0009 
0010 global M_ oo_
0011 
0012 %fid=fopen([s,'.m'],'w') ;
0013 sm=[s,'.m'];
0014 fid=fopen(sm,'w') ;
0015 
0016 n = size(var_list,1);
0017 if n == 0
0018   n = M_.endo_nbr;
0019   ivar = [1:n]';
0020   var_list = M_.endo_names;
0021 else
0022   ivar=zeros(n,1);
0023   for i=1:n
0024     i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
0025     if isempty(i_tmp)
0026       error (['One of the specified variables does not exist']) ;
0027     else
0028       ivar(i) = i_tmp;
0029     end
0030   end
0031 end
0032 
0033 
0034 for i = 1:n
0035     fprintf(fid,[M_.endo_names(ivar(i),:), '=['],'\n') ;
0036     fprintf(fid,'\n') ;
0037     fprintf(fid,'%15.8g\n',oo_.endo_simul(ivar(i),:)') ;
0038        fprintf(fid,'\n') ;
0039        fprintf(fid,'];\n') ;
0040       fprintf(fid,'\n') ;
0041 end
0042 fclose(fid) ;
0043

Generated on Fri 16-Jun-2006 09:09:06 by m2html © 2003