From 5fbc04ada241999d8db8e25d4058f1081c225da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Thu, 28 Feb 2019 10:14:13 +0100 Subject: [PATCH] Return 0 if the input is not the name of an endogenous variable. Also removed the call to deprecated strmatch. [skip ci] (cherry picked from commit 3400e13c0697ba657dd0e7b913d65eeed09d9fb2) --- matlab/get_aux_variable_id.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/matlab/get_aux_variable_id.m b/matlab/get_aux_variable_id.m index bdcc7c824..a15a69e02 100644 --- a/matlab/get_aux_variable_id.m +++ b/matlab/get_aux_variable_id.m @@ -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