diff --git a/matlab/disp_th_moments.m b/matlab/disp_th_moments.m
index 7654c60fd4aa1816d82a1b187ea7a53cc27d7d63..2c990c477536807edd3a92fdb05333f991906791 100644
--- a/matlab/disp_th_moments.m
+++ b/matlab/disp_th_moments.m
@@ -82,6 +82,13 @@ if ~options_.noprint %options_.nomoments == 0
     end
 end
 
+if length(i1) == 0
+    disp(' ')
+    disp('All endogenous are constant or non stationary, not displaying correlations and auto-correlations')
+    disp(' ')
+    return;
+end
+
 if options_.nocorr == 0 && size(stationary_vars, 1) > 0
     corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
     if ~options_.noprint,