diff --git a/matlab/cherrypick.m b/matlab/cherrypick.m index 51a142a46..5ca8ea925 100644 --- a/matlab/cherrypick.m +++ b/matlab/cherrypick.m @@ -74,7 +74,7 @@ for i=1:length(eqtags) rhs = []; lhs = []; % Get equation number. - eqnum = get_equation_number_by_tag(eqtags{i}); + eqnum = get_equation_number_by_tag(eqtags{i}, M_); % Get the original equation. [LHS, RHS] = get_lhs_and_rhs(eqtags{i}, M_, true); % Get the parameters, endogenous and exogenous variables in the current equation. diff --git a/matlab/get_equation_number_by_tag.m b/matlab/get_equation_number_by_tag.m index 596a5c1b3..fc7d097c4 100644 --- a/matlab/get_equation_number_by_tag.m +++ b/matlab/get_equation_number_by_tag.m @@ -1,14 +1,15 @@ -function eqnumber = get_equation_number_by_tag(eqname) +function eqnumber = get_equation_number_by_tag(eqname, DynareModel) % Translates an equation name into an equation number. % % INPUTS -% - eqname [string] Name of the equation. +% - eqname [char] 1×n array, name of the equation. +% - DynareModel [struct] Structure describing the model, aka M_. % % OUTPUTS -% - eqnumber [integer] Equation number. +% - eqnumber [integer] Equation number. -% Copyright (C) 2018 Dynare Team +% Copyright © 2018-2020 Dynare Team % % This file is part of Dynare. % @@ -25,8 +26,6 @@ function eqnumber = get_equation_number_by_tag(eqname) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -global M_ - -eqnumber = strmatch(eqname, M_.equations_tags(strmatch('name', M_.equations_tags(:,2), 'exact'), 3), 'exact'); +eqnumber = strmatch(eqname, DynareModel.equations_tags(strmatch('name', DynareModel.equations_tags(:,2), 'exact'), 3), 'exact'); if isempty(eqnumber), eqnumber = 0; end \ No newline at end of file