From 98de4e44274233d16e2a347bdd627988f578379b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Tue, 10 Dec 2019 22:40:23 +0100 Subject: [PATCH] Less cryptic error message when variable is missing in the database. --- matlab/ols/parse_ols_style_equation.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matlab/ols/parse_ols_style_equation.m b/matlab/ols/parse_ols_style_equation.m index d5eab117d..bbe063ec9 100644 --- a/matlab/ols/parse_ols_style_equation.m +++ b/matlab/ols/parse_ols_style_equation.m @@ -313,7 +313,11 @@ if strcmp(node.node_type, 'NumConstNode') elseif strcmp(node.node_type, 'VariableNode') if strcmp(node.type, 'endogenous') ... || (strcmp(node.type, 'exogenous') && any(strcmp(ds.name, node.name))) - X = ds.(node.name)(node.lag); + if ds.exist(node.name) + X = ds.(node.name)(node.lag); + else + error('Variable %s is not available in the database.', node.name) + end elseif strcmp(node.type, 'parameter') X = M_.params(not(cellfun('isempty', strfind(M_.param_names, node.name)))); if isnan(X) || isinf(X) || ~isreal(X)