Skip to content
Snippets Groups Projects
Verified Commit bd69cd0b authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

dyntable: fix column width calculation in case of minus sign

By the same token, improve the logical expression for determining whether all
values are infinite (it was nevertheless giving the right result, because an
“all()” is implicit when an array of booleans is passed to an “if” statement).

(cherry picked from commit ca4601bd)
parent c1b12b3f
No related branches found
No related tags found
No related merge requests found
Pipeline #6639 passed
...@@ -15,7 +15,7 @@ function dyntable(options_, title, headers, labels, values, label_width, val_wid ...@@ -15,7 +15,7 @@ function dyntable(options_, title, headers, labels, values, label_width, val_wid
% OUTPUTS % OUTPUTS
% none % none
% Copyright (C) 2002-2018 Dynare Team % Copyright (C) 2002-2022 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -46,12 +46,12 @@ label_format_leftbound = sprintf('%%-%ds', label_width); ...@@ -46,12 +46,12 @@ label_format_leftbound = sprintf('%%-%ds', label_width);
% Set width of other columns % Set width of other columns
if all(~isfinite(values)) if all(all(~isfinite(values)))
values_length = 4; values_length = 4;
else else
values_length = max(ceil(max(max(log10(abs(values(isfinite(values))))))),1)+val_precis+1; values_length = max(ceil(max(max(log10(abs(values(isfinite(values))))))),1)+val_precis+1;
end end
if any(values) < 0 %add one character for minus sign if any(any(values < 0)) %add one character for minus sign
values_length = values_length+1; values_length = values_length+1;
end end
headers_length = cellofchararraymaxlength(headers(2:end)); headers_length = cellofchararraymaxlength(headers(2:end));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment