diff --git a/matlab/evaluate_planner_objective.m b/matlab/evaluate_planner_objective.m
index 69f24c6e5b1395724e46780794f0abee6296fbc1..9edb4002387104ee498848d08bcd07f5952de53d 100644
--- a/matlab/evaluate_planner_objective.m
+++ b/matlab/evaluate_planner_objective.m
@@ -32,6 +32,12 @@ dr = oo.dr;
 exo_nbr = M.exo_nbr;
 nstatic = M.nstatic;
 nspred = M.nspred;
+if nspred > 180
+    disp(' ')
+    disp(['evaluate_planner_objective: model too large, can''t evaluate planner ' ...
+          'objective'])
+    return NaN
+end
 beta = get_optimal_policy_discount_factor(M.params,M.param_names);
     
 Gy = dr.ghx(nstatic+(1:nspred),:);