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

Also removed the call to deprecated strmatch.

[skip ci]
time-shift
Stéphane Adjemian (Charybdis) 2019-02-28 10:14:13 +01:00
parent 81d9b08050
commit 3400e13c06
Signed by untrusted user who does not match committer: stepan
GPG Key ID: A6D44CB9C64CE77B
1 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ function ida = get_aux_variable_id(var)
% OUTPUTS
% - 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.
%
@ -33,9 +33,10 @@ if isempty(var)
end
if ischar(var)
id = strmatch(var, M_.endo_names, 'exact');
if isempty(var)
error('Variable %s is unkown.', var)
id = find(strcmp(var, M_.endo_names));
if isempty(id)
ida = 0;
return
else
var = id;
end