Changed the type of the variable returned by list_of_parameters_calibrated_as_{Inf,NaN}.

time-shift
Stéphane Adjemian (Charybdis) 2018-01-10 10:35:17 +01:00
parent 270246acb0
commit dfcb9df58d
4 changed files with 25 additions and 18 deletions

View File

@ -574,11 +574,11 @@ if info(1)
plist = list_of_parameters_calibrated_as_NaN(M); plist = list_of_parameters_calibrated_as_NaN(M);
if ~isempty(plist) if ~isempty(plist)
message = ['dynare_estimation_init:: Some of the parameters are NaN (' ]; message = ['dynare_estimation_init:: Some of the parameters are NaN (' ];
for i=1:size(plist,1) for i=1:length(plist)
if i<size(plist,1) if i<length(plist)
message = [message, deblank(plist(i,:)) ', ']; message = [message, plist{i} ', '];
else else
message = [message, deblank(plist(i,:)) ')']; message = [message, plist{i} ')'];
end end
end end
end end
@ -586,11 +586,11 @@ if info(1)
plist = list_of_parameters_calibrated_as_Inf(M); plist = list_of_parameters_calibrated_as_Inf(M);
if ~isempty(plist) if ~isempty(plist)
message = ['dynare_estimation_init:: Some of the parameters are Inf (' ]; message = ['dynare_estimation_init:: Some of the parameters are Inf (' ];
for i=1:size(plist,1) for i=1:length(plist)
if i<size(plist,1) if i<size(plist)
message = [message, deblank(plist(i,:)) ', ']; message = [message, plist{i} ', '];
else else
message = [message, deblank(plist(i,:)) ')']; message = [message, plist{i} ')'];
end end
end end
end end

View File

@ -5,7 +5,7 @@ function list = list_of_parameters_calibrated_as_Inf(M_)
% M_ [structure] Description of the (simulated or estimated) model. % M_ [structure] Description of the (simulated or estimated) model.
% %
% OUTPUTS % OUTPUTS
% list [char] n*p array of characters, each line is the name of parameter without value. % list [cell] Each element is the name (row char array) of parameter without value.
% %
% ALGORITHM % ALGORITHM
% none % none
@ -13,7 +13,7 @@ function list = list_of_parameters_calibrated_as_Inf(M_)
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
% Copyright (C) 2017 Dynare Team % Copyright (C) 2017-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -29,9 +29,12 @@ function list = list_of_parameters_calibrated_as_Inf(M_)
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
idx = find(isinf(M_.params)); idx = find(isinf(M_.params));
nnn = length(idx); nnn = length(idx);
list = [];
if nnn if nnn
list = M_.param_names(idx,:); list = M_.param_names(idx);
else
list = {};
end end

View File

@ -1,11 +1,12 @@
function list = list_of_parameters_calibrated_as_NaN(M_) function list = list_of_parameters_calibrated_as_NaN(M_)
% The name of the function is explicit enough... % The name of the function is explicit enough...
% %
% INPUTS % INPUTS
% M_ [structure] Description of the (simulated or estimated) model. % M_ [structure] Description of the (simulated or estimated) model.
% %
% OUTPUTS % OUTPUTS
% list [char] n*p array of characters, each line is the name of parameter without value. % list [cell] Each element is the name (row char array) of parameter without value.
% %
% ALGORITHM % ALGORITHM
% none % none
@ -13,7 +14,7 @@ function list = list_of_parameters_calibrated_as_NaN(M_)
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
% Copyright (C) 2010-2017 Dynare Team % Copyright (C) 2010-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -29,9 +30,12 @@ function list = list_of_parameters_calibrated_as_NaN(M_)
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
idx = find(isnan(M_.params)); idx = find(isnan(M_.params));
nnn = length(idx); nnn = length(idx);
list = [];
if nnn if nnn
list = M_.param_names(idx,:); list = M_.param_names(idx);
else
list = {};
end end

View File

@ -33,8 +33,8 @@ plist = list_of_parameters_calibrated_as_NaN(M_);
if ~isempty(plist) if ~isempty(plist)
info=1; info=1;
message = ['Some of the parameters have no value (' ]; message = ['Some of the parameters have no value (' ];
for i=1:size(plist,1) for i=1:length(plist)
if i<size(plist,1) if i<length(plist)
message = [message, plist{i} ', ']; message = [message, plist{i} ', '];
else else
message = [message, plist{i} ')']; message = [message, plist{i} ')'];