2022-10-26 14:16:53 +02:00
|
|
|
|
function eqnumber = get_equation_number_by_tag(eqname, M_)
|
2023-10-25 10:14:12 +02:00
|
|
|
|
% eqnumber = get_equation_number_by_tag(eqname, M_)
|
2018-05-29 15:44:41 +02:00
|
|
|
|
% Translates an equation name into an equation number.
|
|
|
|
|
%
|
|
|
|
|
% INPUTS
|
2020-02-02 21:14:23 +01:00
|
|
|
|
% - eqname [char] 1×n array, name of the equation.
|
2023-10-25 10:14:12 +02:00
|
|
|
|
% - M_ [struct] Structure describing the model
|
2018-05-29 15:44:41 +02:00
|
|
|
|
%
|
|
|
|
|
% OUTPUTS
|
2020-02-02 21:14:23 +01:00
|
|
|
|
% - eqnumber [integer] Equation number.
|
2018-05-29 15:44:41 +02:00
|
|
|
|
|
2023-10-25 10:14:12 +02:00
|
|
|
|
% Copyright © 2018-2023 Dynare Team
|
2018-05-29 15:44:41 +02:00
|
|
|
|
%
|
|
|
|
|
% This file is part of Dynare.
|
|
|
|
|
%
|
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
% (at your option) any later version.
|
|
|
|
|
%
|
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
|
%
|
|
|
|
|
% You should have received a copy of the GNU General Public License
|
2021-06-09 17:33:48 +02:00
|
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2018-05-29 15:44:41 +02:00
|
|
|
|
|
2022-10-26 14:16:53 +02:00
|
|
|
|
idx = find(strcmp(M_.equations_tags(:,2), 'name') & ...
|
|
|
|
|
strcmp(M_.equations_tags(:,3), eqname));
|
2018-05-29 15:44:41 +02:00
|
|
|
|
|
2022-10-26 14:16:53 +02:00
|
|
|
|
if isempty(idx)
|
|
|
|
|
eqnumber = 0;
|
|
|
|
|
else
|
|
|
|
|
eqnumber = M_.equations_tags{idx, 1};
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|