Skip to content
Snippets Groups Projects
Unverified Commit 3400e13c authored by Stéphane Adjemian (Charybdis)'s avatar Stéphane Adjemian (Charybdis)
Browse files

Return 0 if the input is not the name of an endogenous variable.

Also removed the call to deprecated strmatch.

[skip ci]
parent 81d9b080
Branches
Tags
No related merge requests found
Checking pipeline status
...@@ -8,7 +8,7 @@ function ida = get_aux_variable_id(var) ...@@ -8,7 +8,7 @@ function ida = get_aux_variable_id(var)
% OUTPUTS % OUTPUTS
% - ida [integer] Corresponding index in M_.aux_vars. % - ida [integer] Corresponding index in M_.aux_vars.
% Copyright (C) 2018 Dynare Team % Copyright (C) 2018-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -33,9 +33,10 @@ if isempty(var) ...@@ -33,9 +33,10 @@ if isempty(var)
end end
if ischar(var) if ischar(var)
id = strmatch(var, M_.endo_names, 'exact'); id = find(strcmp(var, M_.endo_names));
if isempty(var) if isempty(id)
error('Variable %s is unkown.', var) ida = 0;
return
else else
var = id; var = id;
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment