Skip to content
Snippets Groups Projects
Verified Commit f39f57b9 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added parameter values in cherrypick/agregate routines.

parent df66ec5b
Branches
Tags
No related merge requests found
...@@ -19,7 +19,7 @@ function agregate(ofile, varargin) ...@@ -19,7 +19,7 @@ function agregate(ofile, varargin)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
MAX_NUMBER_OF_ELEMENTS = 1000; MAX_NUMBER_OF_ELEMENTS = 10000;
warning off MATLAB:subscripting:noSubscriptsSpecified warning off MATLAB:subscripting:noSubscriptsSpecified
...@@ -107,6 +107,18 @@ for i=1:length(varargin) ...@@ -107,6 +107,18 @@ for i=1:length(varargin)
end end
xlist = xlist(1:xnum,:); xlist = xlist(1:xnum,:);
% Get parameter values.
calibration = '';
for i=1:length(varargin)
fid = fopen(sprintf('%s/parameter-values.inc', varargin{i}));
cline = fgetl(fid);
while ischar(cline)
calibration = sprintf('%s\n%s', calibration, cline);
cline = fgetl(fid);
end
fclose(fid);
end
% Move the endogenous variables which are not LHS of an equation % Move the endogenous variables which are not LHS of an equation
% into the set of exogenous variables. % into the set of exogenous variables.
[~, i1] = intersect(elist(:,1), eqlist(:,1)); [~, i1] = intersect(elist(:,1), eqlist(:,1));
...@@ -132,6 +144,8 @@ for i=1:length(plist) ...@@ -132,6 +144,8 @@ for i=1:length(plist)
fprintf(fid, '\t%s\n', plist{i}); fprintf(fid, '\t%s\n', plist{i});
end end
fprintf(fid, ';\n\n'); fprintf(fid, ';\n\n');
fprintf(fid, calibration);
fprintf(fid, '\n\n');
fprintf(fid, 'var\n'); fprintf(fid, 'var\n');
for i=1:rows(elist) for i=1:rows(elist)
if isempty(elist{i,2}) if isempty(elist{i,2})
......
...@@ -168,6 +168,15 @@ fid = fopen(sprintf('%s/exogenous.inc', outfold), 'w'); ...@@ -168,6 +168,15 @@ fid = fopen(sprintf('%s/exogenous.inc', outfold), 'w');
printlistofvariables(fid, 'exo', xlist, M_); printlistofvariables(fid, 'exo', xlist, M_);
fclose(fid); fclose(fid);
% Export parameter values
fid = fopen(sprintf('%s/parameter-values.inc', outfold), 'w');
for i=1:length(plist)
id = strcmp(plist{i}, M_.param_names);
if any(id)
fprintf(fid, '%s = %s;\n', plist{i}, num2str(M_.params(id), 16));
end
end
fclose(fid);
function printlistofvariables(fid, kind, list, DynareModel) function printlistofvariables(fid, kind, list, DynareModel)
if isfield(DynareModel, sprintf('%s_partitions', kind)) if isfield(DynareModel, sprintf('%s_partitions', kind))
......
a1 = .1;
b1 = .2;
c1 = .3;
d1 = .4;
e1 = .5;
f1 = .6;
g1 = .7;
\ No newline at end of file
a2 = -.1;
b2 = -.2;
c2 = -.3;
d2 = -.4;
e2 = -.5;
f2 = -.6;
g2 = -.7;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment