From ee07c57c33995d54d6dea40323b910da21f86115 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Tue, 1 Aug 2017 12:29:16 +0200
Subject: [PATCH] Provide meaningful error message if oo_.exo_simul is larger
 than options_.periods

(cherry picked from commit 97b894a1cdb2f47171e42448c4a6f416d26c8f31)
---
 matlab/perfect-foresight-models/perfect_foresight_setup.m | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/matlab/perfect-foresight-models/perfect_foresight_setup.m b/matlab/perfect-foresight-models/perfect_foresight_setup.m
index 341d70aad..1b502c4ad 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_setup.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_setup.m
@@ -51,6 +51,10 @@ 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])
+    error('PERFECT_FORESIGHT_SETUP: number of periods for the simulation is specified to be smaller than the period of the last shock')
+end
+
 if ~options_.initval_file
     if isempty(options_.datafile)
         oo_=make_ex_(M_,options_,oo_);
-- 
GitLab