From 4a646e4ab38099bb1a269a01d9b6ee407ddba9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Mon, 5 Mar 2018 12:32:35 +0100 Subject: [PATCH] Fixed check on equation tag (plot_contributions). --- matlab/plot_contributions.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/matlab/plot_contributions.m b/matlab/plot_contributions.m index 5b5d13dc6..8c5807e13 100644 --- a/matlab/plot_contributions.m +++ b/matlab/plot_contributions.m @@ -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;