Fixed check on equation tag (plot_contributions).

time-shift
Stéphane Adjemian(Charybdis) 2018-03-05 12:32:35 +01:00
parent 71ad2cf13b
commit 4a646e4ab3
1 changed files with 6 additions and 2 deletions

View File

@ -22,7 +22,7 @@ function plot_contributions(equationname, ds1, ds0)
% [name='Phillips curve']
% pi = beta*pi(1) + slope*y + lam;
% Copyright (C) 2017-2018 Dynare Team
% Copyright (C) 2017 Dynare Team
%
% This file is part of Dynare.
%
@ -56,6 +56,11 @@ if ~ischar(equationname)
error('First argument must be a string.')
end
% Check that the equation name is actually the name of an equation in the model.
if ~ismember(equationname, M_.equations_tags(strmatch('name', M_.equations_tags(:,2)),3))
error('There is no equation named as %s!', equationname);
end
% Check second argument
if ischar(ds1)
if ismember(ds1, evalin('caller','who'))
@ -96,7 +101,6 @@ end
jsonmodel = loadjson(jsonfile);
jsonmodel = jsonmodel.model;
jsonmodel = getEquationsByTags(jsonmodel, 'name', equationname);
assert(~isempty(jsonmodel), ['No equation found with tag name: ' equationname]);
lhs = jsonmodel{1}.lhs;
rhs = jsonmodel{1}.rhs;