diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m
index 1091dbc036aecd6c2bcdad8ee66d4258feac5de3..7aa7b05ff0ddafcda427227ba9a14f25bbad83b7 100644
--- a/matlab/McMCDiagnostics.m
+++ b/matlab/McMCDiagnostics.m
@@ -69,6 +69,15 @@ if issue_an_error_message
     error('Estimation::mcmc::diagnostics: I cannot proceed because some MCMC files are missing. Check your MCMC files...')
 end
 
+PastDraws = sum(record.MhDraws,1);
+LastFileNumber = PastDraws(2);
+LastLineNumber = record.MhDraws(end,3);
+NumberOfDraws  = PastDraws(1);
+
+if LastLineNumber<=2000
+    warning(['estimation:: MCMC convergence diagnostics are not computed because the total number of iterations is less than 2000!'])
+    return
+end
 
 if nblck == 1 % Brooks and Gelman tests need more than one block
     convergence_diagnostics_geweke=zeros(npar,4+2*length(options_.convergence.geweke.taper_steps));
@@ -121,11 +130,6 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
     return;
 end
 
-PastDraws = sum(record.MhDraws,1);
-LastFileNumber = PastDraws(2);
-LastLineNumber = record.MhDraws(end,3);
-NumberOfDraws  = PastDraws(1);
-
 Origin = 1000;
 StepSize = ceil((NumberOfDraws-Origin)/100);% So that the computational time does not 
 ALPHA = 0.2;                                % increase too much with the number of simulations. 
diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index 9bf5c25327a1ebae47af65e80050ff12bce4f198..6ba4dd80f9c862a5b717bfff783b03b0761be8f8 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -789,7 +789,7 @@ if (any(bayestopt_.pshape  >0 ) && options_.mh_replic) || ...
         CutSample(M_, options_, estim_params_);
         return
     else
-        if ~options_.nodiagnostic && options_.mh_replic > 2000
+        if ~options_.nodiagnostic && options_.mh_replic>0
             oo_= McMCDiagnostics(options_, estim_params_, M_,oo_);
         end
         %% Here i discard first half of the draws: