diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m index e7e3c170e..572e4f397 100644 --- a/matlab/McMCDiagnostics.m +++ b/matlab/McMCDiagnostics.m @@ -18,7 +18,7 @@ npar = npar + estim_params_.ncn; npar = npar + estim_params_.np ; MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8); -load(['.\' M_.dname '\metropolis\' M_.fname '_mh_history.mat']) +load(['./' M_.dname '/metropolis/' M_.fname '_mh_history.mat']) PastDraws = sum(record.MhDraws,1); LastFileNumber = PastDraws(2); @@ -49,13 +49,13 @@ for j=1:npar for b = 1:nblck startline = 0; for n = 1:LastFileNumber-1 - eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(n) '_blck' int2str(b)]); + eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(n) '_blck' int2str(b)]); clear logpo2 post2; tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = x2(:,j); clear x2; startline = startline + MAX_nruns; end - eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]); + eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]); clear logpo2 post2; tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = x2(:,j); clear x2; @@ -228,7 +228,7 @@ clear UDIAG; %% Multivariate diagnostic. %% if TeX - fidTeX = fopen([M_.dname '\TeX\' M_.fname '_MultivariateDiagnostics.TeX'],'w'); + fidTeX = fopen([M_.dname '/TeX/' M_.fname '_MultivariateDiagnostics.TeX'],'w'); fprintf(fidTeX,'%% TeX eps-loader file generated by McmcDiagnostics.m (Dynare).\n'); fprintf(fidTeX,['%% ' datestr(now,0) '\n']); fprintf(fidTeX,' \n'); @@ -239,12 +239,12 @@ MDIAG = zeros(NumberOfLines,6); for b = 1:nblck startline = 0; for n = 1:LastFileNumber-1 - eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(n) '_blck' int2str(b)]); + eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(n) '_blck' int2str(b)]); clear x2 post2; tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = logpo2; startline = startline+MAX_nruns; end - eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]); + eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]); clear x2 post2; tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+ MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = logpo2; end @@ -323,4 +323,4 @@ if TeX fprintf(fidTeX,'\n'); fprintf(fidTeX,'% End Of TeX file.'); fclose(fidTeX); -end \ No newline at end of file +end diff --git a/matlab/metropolis.m b/matlab/metropolis.m index 7337abcf7..915f1d82f 100644 --- a/matlab/metropolis.m +++ b/matlab/metropolis.m @@ -227,7 +227,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings % (if there was a complete session before the crash) ? if OldMh ante = sum(record.MhDraws(1:end-1,2),1); - load(['.\' DirectoryName '/' M_.fname '_mh' int2str(ante) '_blck' ... + load(['./' DirectoryName '/' M_.fname '_mh' int2str(ante) '_blck' ... int2str(CrashedBlck) '.mat'],'logpo2'); if length(logpo2) == MAX_nruns IsTheLastFileOfThePreviousMhFull = 1; @@ -243,7 +243,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings MhFileNumber = ante; while MhFileExist MhFileNumber = MhFileNumber + 1; - if ~exist(['.\' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber) '_blck' int2str(CrashedBlck) '.mat']) + if ~exist(['./' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber) '_blck' int2str(CrashedBlck) '.mat']) MhFileExist = 0; end end @@ -265,7 +265,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings nruns(CrashedBlck) = nruns(CrashedBlck)-NumberOfSavedDraws; % I initialize with the last saved mh file of the inccomplete % block: - load(['.\' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber-1) '_blck' int2str(CrashedBlck) '.mat']); + load(['./' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber-1) '_blck' int2str(CrashedBlck) '.mat']); ilogpo2(CrashedBlck) = logpo2(end); ix2(CrashedBlck,:) = x2(end,:); NewFile(CrashedBlck) = MhFileNumber; @@ -282,7 +282,7 @@ end% of (if options_.load_mh_file == {0,1 or -1}) InitSizeArray = min([MAX_nruns*ones(nblck) nruns],[],2); for b = fblck:nblck if (options_.load_mh_file~=0) & (fline(b)>1) & OpenOldFile(b) - load(['.\' DirectoryName '/' M_.fname '_mh' int2str(NewFile(b)) ... + load(['./' DirectoryName '/' M_.fname '_mh' int2str(NewFile(b)) ... '_blck' int2str(b) '.']) x2 = [x2;zeros(InitSizeArray(b)-fline(b)+1,npar)]; logpo2 = [logpo2;zeros(InitSizeArray(b)-fline(b)+1,1)];