From 4273714539ab8c26f427a4fb2a67028f76e66c33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr>
Date: Mon, 29 Aug 2011 17:35:35 +0200
Subject: [PATCH] Theoretical moments: handle nicely the case where all
 variables are either constant or non stationary (cherry picked from commit
 df0edeecf06421eb72ef0d55d496955517cd97a1)

---
 matlab/disp_th_moments.m | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/matlab/disp_th_moments.m b/matlab/disp_th_moments.m
index 7654c60fd..2c990c477 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,
-- 
GitLab