From 52e5b567eb98b331d3c741566d0038c7827d49ba Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx,de>
Date: Sat, 15 Feb 2014 17:01:41 +0100
Subject: [PATCH] Change disp() to errors in var_sample_moments.m

Otherwise, the data moments that are required for estimating DSGE-VARs are set to an empty matrix instead of aborting. This will then lead to a cryptic crash in initial_estimation_checks.m due to matrix dimensions not agreeing.
---
 matlab/var_sample_moments.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/matlab/var_sample_moments.m b/matlab/var_sample_moments.m
index 834eb81522..ab7b4b74b6 100644
--- a/matlab/var_sample_moments.m
+++ b/matlab/var_sample_moments.m
@@ -78,7 +78,7 @@ XtX = [];
 data = read_variables(datafile,varobs,[],xls_sheet,xls_range);
 
 if qlag > FirstObservation
-    disp('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.')
+    error('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.')
     return
 end
 
@@ -93,7 +93,7 @@ elseif var_trend_order == 1;% Constant and linear trend case.
 X = ones(NumberOfObservations,NumberOfVariables*qlag+2);
 indx = NumberOfVariables*qlag+1:NumberOfVariables*qlag+2;
 else
-    disp('var_sample_moments :: trend must be equal to -1,0 or 1!')
+    error('var_sample_moments :: trend must be equal to -1,0 or 1!')
     return
 end
 
-- 
GitLab