From 10047feee5e04610606bd6b65517d794a4a4aaf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Wed, 16 Aug 2017 16:04:15 +0200
Subject: [PATCH] Test if shocks are declared.

Fixes bug introduced in 97b894a1cdb2f47171e42448c4a6f416d26c8f31, if no shocks
are declared (for instance if the user is interested in the transition to the
steady state).
---
 matlab/perfect-foresight-models/perfect_foresight_setup.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/perfect-foresight-models/perfect_foresight_setup.m b/matlab/perfect-foresight-models/perfect_foresight_setup.m
index 1b502c4adb..fc6a4bce75 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_setup.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_setup.m
@@ -51,7 +51,7 @@ if options_.periods == 0
     error('PERFECT_FORESIGHT_SETUP: number of periods for the simulation isn''t specified')
 end
 
-if options_.periods<max([M_.det_shocks.periods])
+if ~isempty(M_.det_shocks) && options_.periods<max([M_.det_shocks.periods])
     error('PERFECT_FORESIGHT_SETUP: number of periods for the simulation is specified to be smaller than the period of the last shock')
 end
 
-- 
GitLab