From de573890b74fe27d1e54f9b3fb2674f8a06d241c Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 5 Feb 2019 19:52:12 +0100 Subject: [PATCH] fix bug in handling unary minus node as uminus is not a valid dseries operation --- 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 acef0686f..56292854d 100644 --- a/matlab/ols/parse_ols_style_equation.m +++ b/matlab/ols/parse_ols_style_equation.m @@ -342,7 +342,11 @@ elseif strcmp(node.node_type, 'UnaryOpNode') % Only works if dseries supports . notation for unary op (true for log/diff) % Otherwise, use: X = eval([node.op '(Xtmp)']); try - X = Xtmp.(node.op); + if strcmp(node.op, 'uminus') + X = -Xtmp; + else + X = Xtmp.(node.op); + end if any(isinf(X)) || ~isreal(X) parsing_error(['Error applying ' node.op], line, node); end