From a04c348d734d21d1e569754369be4def3365c3d0 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 22 Jul 2021 12:21:35 +0200
Subject: [PATCH] smoother2histval.m: provide warning when smoothed variables
 are missing

---
 matlab/smoother2histval.m | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/matlab/smoother2histval.m b/matlab/smoother2histval.m
index 84865a1ac8..7e90e41ef3 100644
--- a/matlab/smoother2histval.m
+++ b/matlab/smoother2histval.m
@@ -78,6 +78,11 @@ end
 
 if post_metropolis
     tmp = fieldnames(smoothedvars.Mean);
+    if length(tmp)~=M_.endo_nbr
+        warning(['You are using smoother2histval although smoothed values have not'...
+            'been computed for all endogenous and auxiliary variables.'...
+            'The value of these variables will be set to 0.'])
+    end
     tmpexo = fieldnames(smoothedshocks.Mean);
 else
     tmp = fieldnames(smoothedvars);
-- 
GitLab