From 0ce32f3367234d49a8b5fecbe4b7fd5636765bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Guts=29?= Date: Sat, 16 Dec 2023 10:05:41 +0100 Subject: [PATCH] [WIP] Error takes sprintf like arguments directly. --- matlab/accessors/get_param_by_name.m | 2 +- matlab/estimation/draw_prior_density.m | 6 +++--- matlab/lmmcp/get_complementarity_conditions.m | 9 +++------ matlab/modules/dseries | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/matlab/accessors/get_param_by_name.m b/matlab/accessors/get_param_by_name.m index 8b9b06c39..60aa60984 100644 --- a/matlab/accessors/get_param_by_name.m +++ b/matlab/accessors/get_param_by_name.m @@ -33,7 +33,7 @@ global M_ i = strmatch(pname,M_.param_names,'exact'); if isempty(i) - error(sprintf('Can''t find parameter %s', pname)) + error('Can''t find parameter %s', pname) end x = M_.params(i); diff --git a/matlab/estimation/draw_prior_density.m b/matlab/estimation/draw_prior_density.m index 59a471957..348231a22 100644 --- a/matlab/estimation/draw_prior_density.m +++ b/matlab/estimation/draw_prior_density.m @@ -80,7 +80,7 @@ switch pshape(indx) abscissa = linspace(infbound,supbound,steps); dens = density(abscissa,p6(indx),p7(indx),p3(indx)); otherwise - error(sprintf('draw_prior_density: unknown distribution shape (index %d, type %d)', indx, pshape(indx))); + error('draw_prior_density: unknown distribution shape (index %d, type %d)', indx, pshape(indx)); end if pshape(indx) ~= 5 @@ -88,9 +88,9 @@ if pshape(indx) ~= 5 if k1 == 1 || k1 == length(dens) k = find(dens > 10); dens(k) = NaN; + end end -end binf = abscissa(1); bsup = abscissa(end); x = abscissa; -f = dens; \ No newline at end of file +f = dens; diff --git a/matlab/lmmcp/get_complementarity_conditions.m b/matlab/lmmcp/get_complementarity_conditions.m index 6bf8bf548..5d3f961f5 100644 --- a/matlab/lmmcp/get_complementarity_conditions.m +++ b/matlab/lmmcp/get_complementarity_conditions.m @@ -57,8 +57,7 @@ for i=1:size(etags,1) if ~isempty(kop) k = find(strcmp(strtrim(str(1:kop-1)), M_.endo_names)); %get variable index with restriction if isempty(k) - error(sprintf(['Complementarity condition %s: variable %s is ' ... - 'not recognized'],etags{i,3},strtrim(str(1:kop-1)))) + error('Complementarity condition %s: variable %s is not recognized', etags{i,3}, strtrim(str(1:kop-1))) end ub(k) = str2num(str(kop+1:end)); eq_index(eq_nbr) = k; @@ -68,15 +67,13 @@ for i=1:size(etags,1) if ~isempty(kop) k = find(strcmp(strtrim(str(1:kop-1)), M_.endo_names)); %get variable index with restriction if isempty(k) - error(sprintf(['Complementarity condition %s: variable %s is ' ... - 'not recognized'],etags{i,3},strtrim(str(1:kop-1)))) + error('Complementarity condition %s: variable %s is not recognized', etags{i,3}, strtrim(str(1:kop-1))) end lb(k) = str2num(str(kop+1:end)); eq_index(eq_nbr) = k; eq_index(k) = eq_nbr; else - error(sprintf(['Complementarity condition %s can''t be ' ... - 'parsed'],etags{i,3})) + error('Complementarity condition %s can''t be parsed',etags{i,3}) end end end diff --git a/matlab/modules/dseries b/matlab/modules/dseries index 1bb3b1cbc..8acb7f8d5 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit 1bb3b1cbc9d1b29136e8e533d871e247f1b11103 +Subproject commit 8acb7f8d5f6418717a9ad47e6b6b911354a86409