1function writedata_text(fname)
2% function writedata(fname)
3% store endogenous and exogenous variables in a text file
4% INPUT
5%   fname: name of the text file
6% OUTPUT
7%   none
8% ALGORITHM
9%   none
10% SPECIAL REQUIREMENT
11%   none
12
13% Copyright (C) 2007-2018 Dynare Team
14%
15% This file is part of Dynare.
16%
17% Dynare is free software: you can redistribute it and/or modify
18% it under the terms of the GNU General Public License as published by
19% the Free Software Foundation, either version 3 of the License, or
20% (at your option) any later version.
21%
22% Dynare is distributed in the hope that it will be useful,
23% but WITHOUT ANY WARRANTY; without even the implied warranty of
24% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25% GNU General Public License for more details.
26%
27% You should have received a copy of the GNU General Public License
28% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
29
30global M_ oo_
31S=[fname '_endo.dat'];
32fid = fopen(S,'w');
33for i = 1:M_.endo_nbr
34    fprintf(fid,'%s ', M_.endo_names{i});
35end
36fprintf(fid,'\n');
37for i = 1:size(oo_.endo_simul,2)
38    fprintf(fid,'%15.7f ',oo_.endo_simul(:,i));
39    fprintf(fid,'\n');
40end
41fclose(fid);
42
43S=[fname '_exo.dat'];
44fid = fopen(S,'w');
45for i = 1:M_.exo_nbr
46    fprintf(fid,'%s ',M_.exo_names{i});
47end
48fprintf(fid,'\n');
49for i = 1:size(oo_.exo_simul,1)
50    fprintf(fid,'%15.7f ',oo_.exo_simul(i,:));
51    fprintf(fid,'\n');
52end
53fclose(fid);