From 3dd8d75b869ff4212588d05e4416ccbaffc42696 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Wed, 25 Sep 2024 12:06:59 +0200 Subject: [PATCH] error function: Fix various syntax bugs One input argument is required --- matlab/@dprior/admissible.m | 2 +- matlab/distributions/mode_and_variance_to_mean.m | 3 +-- matlab/estimation/dsge_simulated_theoretical_correlation.m | 3 +-- matlab/estimation/dsge_simulated_theoretical_covariance.m | 3 +-- .../dsge_simulated_theoretical_variance_decomposition.m | 3 +-- tests/write/example1.mod | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/matlab/@dprior/admissible.m b/matlab/@dprior/admissible.m index c3a46c36b5..82cce25f3e 100644 --- a/matlab/@dprior/admissible.m +++ b/matlab/@dprior/admissible.m @@ -133,7 +133,7 @@ try for i = 1:ndraws draw = o.draw(); if ~o.admissible(draw) - error() + error('problem in admissible') end end t(1) = true; diff --git a/matlab/distributions/mode_and_variance_to_mean.m b/matlab/distributions/mode_and_variance_to_mean.m index e4a892829b..1d7f6729ab 100644 --- a/matlab/distributions/mode_and_variance_to_mean.m +++ b/matlab/distributions/mode_and_variance_to_mean.m @@ -177,8 +177,7 @@ if (distribution==4)% Beta distribution if length(idx)>1 error('Multiplicity of solutions for the beta distribution specification.') elseif isempty(idx) - disp('No solution for the beta distribution specification. You should reduce the variance.') - error(); + error('No solution for the beta distribution specification. You should reduce the variance.') end alpha = real_roots(idx); beta = ((1-m)*alpha+2*m-1)/m; diff --git a/matlab/estimation/dsge_simulated_theoretical_correlation.m b/matlab/estimation/dsge_simulated_theoretical_correlation.m index 5d2ed379d4..d874cb54ba 100644 --- a/matlab/estimation/dsge_simulated_theoretical_correlation.m +++ b/matlab/estimation/dsge_simulated_theoretical_correlation.m @@ -44,6 +44,5 @@ if strcmpi(type,'posterior') elseif strcmpi(type,'prior') CorrFileNumber = length(dir([M_.dname '/prior/moments/' M_.fname '_PriorCorrelations*'])); else - disp('dsge_simulated_theoretical_correlation:: Unknown type!'); - error() + error('dsge_simulated_theoretical_correlation:: Unknown type!'); end diff --git a/matlab/estimation/dsge_simulated_theoretical_covariance.m b/matlab/estimation/dsge_simulated_theoretical_covariance.m index 62cbcabd49..31d5a1486d 100644 --- a/matlab/estimation/dsge_simulated_theoretical_covariance.m +++ b/matlab/estimation/dsge_simulated_theoretical_covariance.m @@ -44,8 +44,7 @@ elseif strcmpi(type,'prior') CheckPath('prior/moments',M_.dname); posterior = 0; else - disp('dsge_simulated_theoretical_covariance:: Unknown type!') - error(); + error('dsge_simulated_theoretical_covariance:: Unknown type!') end %delete old stale files before creating new ones diff --git a/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m b/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m index 57e6508cdb..880b27438f 100644 --- a/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m +++ b/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m @@ -46,8 +46,7 @@ elseif strcmpi(type,'prior') CheckPath('prior/moments',M_.dname); posterior = 0; else - disp('dsge_simulated_theoretical_variance_decomposition:: Unknown type!') - error() + error('dsge_simulated_theoretical_variance_decomposition:: Unknown type!') end %delete old stale files before creating new ones diff --git a/tests/write/example1.mod b/tests/write/example1.mod index 8ba9f85a37..889dd5e30d 100644 --- a/tests/write/example1.mod +++ b/tests/write/example1.mod @@ -84,6 +84,6 @@ end; verbatim; if ~isequal(M_.observed_exo_names, {'ey'; 'ex'}) - error() + error('Arguments are not identical') end end; -- GitLab