From 904a11d962001dfc37c9a96aaf88a6e8855fc262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Mon, 5 Mar 2018 12:37:28 +0100 Subject: [PATCH] Fixed case where all parameter values are hard coded (plot_contributions). --- matlab/plot_contributions.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/matlab/plot_contributions.m b/matlab/plot_contributions.m index 5fa451336..faca05dc2 100644 --- a/matlab/plot_contributions.m +++ b/matlab/plot_contributions.m @@ -117,13 +117,16 @@ if ~isempty(regexp(rhs, regexprnoleads(1:end-1), 'match')) end % Get values for the parameters -idp = strmatch(pnames{1}, M_.param_names, 'exact'); -str = sprintf('%s = M_.params(%d);', pnames{1}, idp); -for i=2:length(pnames) - idp = strmatch(pnames{i}, M_.param_names, 'exact'); - str = sprintf('%s %s = M_.params(%d);', str, pnames{i}, idp); +if ~isempty(pnames) + % In case all the parameters are hard coded + idp = strmatch(pnames{1}, M_.param_names, 'exact'); + str = sprintf('%s = M_.params(%d);', pnames{1}, idp); + for i=2:length(pnames) + idp = strmatch(pnames{i}, M_.param_names, 'exact'); + str = sprintf('%s %s = M_.params(%d);', str, pnames{i}, idp); + end + eval(str) end -eval(str) % Replace variables with ds.variablename for i = 1:length(vnames)