1function update_last_mh_history_file(MetropolisFolder, ModelName, record) 2% function update_last_mh_history_file(MetropolisFolder, ModelName, record) 3% Updates the mh_history_file 4% Inputs: 5% MetropolisFolder [char] Name of the metropolis subfolder 6% ModelName [char] Name of the mod-file 7% record [structure] structure storing the MH history 8% Outputs: none 9 10% Copyright (C) 2013-2017 Dynare Team 11% 12% This file is part of Dynare. 13% 14% Dynare is free software: you can redistribute it and/or modify 15% it under the terms of the GNU General Public License as published by 16% the Free Software Foundation, either version 3 of the License, or 17% (at your option) any later version. 18% 19% Dynare is distributed in the hope that it will be useful, 20% but WITHOUT ANY WARRANTY; without even the implied warranty of 21% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22% GNU General Public License for more details. 23% 24% You should have received a copy of the GNU General Public License 25% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 26 27BaseName = [MetropolisFolder filesep ModelName]; 28 29% Get the list of all the mh_history files. 30mh_history_files = dir([BaseName '_mh_history_*.mat']); 31 32% Check the existence of mh-files (assuming version 2, ie dynare version greater than 4.3.x). 33if isequal(length(mh_history_files),0) 34 error(['Estimation::update_mh_file: I cannot find any mh-history file in ' MetropolisFolder '!']) 35end 36 37BaseName = [BaseName '_mh_history_']; 38 39save([BaseName num2str(length(mh_history_files)-1) '.mat'],'record','-append');