% This script assumes that the ss_values are in the Matlab object:
% oo_.steady_state. It then creates a .m file that Dynare can read
% when asked to compute the ss of a model.

dynare_ssfile = [];
dynare_ssfile = [dynare_ssfile,10,'function [ssval,check] = ',M_.fname,'_steadystate(y,x)'];
dynare_ssfile = [dynare_ssfile,10,'%this is a comment',10,'%'];
dynare_ssfile = [dynare_ssfile,10,'check = 0;',10];

% dynare_ssfile = [dynare_ssfile,10,'ssval = y;'];
% dynare_ssfile = [dynare_ssfile,10,'return',10];

for ii = 1:length(oo_.steady_state)
  dynare_ssfile = [dynare_ssfile,10,'ssval(',num2str(ii),',1) =  ',num2str(oo_.steady_state(ii),16),';'];
end%for

dynare_ssfile = [dynare_ssfile,10];
  
% Save the steady state file as a separate file.
fid = fopen([M_.fname,'_steadystate.m'],'w+');
fwrite(fid,dynare_ssfile);
fclose(fid);
