Commit afcbcece authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: make zerotol work for both graphs and reports

parent d94cc0d2
......@@ -36,7 +36,7 @@ dataString = sprintf('%%.%df', precision);
precision = 10^precision;
data = dser(dates);
data = data.data;
data = setDataToZeroFromZeroTol(o, data);
for i=1:size(data,1)
fprintf(fid, '&');
if o.tableShowMarkers
......
function d = setDataToZeroFromZeroTol(o, ds)
%function d = setDataToZeroFromZeroTol(o, ds)
% Copyright (C) 2014 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
d = ds.data;
stz = bsxfun(@and, ...
bsxfun(@lt, d, o.zeroTol), ...
bsxfun(@gt, d, -o.zeroTol));
if any(stz)
d(stz) = 0;
end
end
\ No newline at end of file
......@@ -105,16 +105,7 @@ else
ds = o.data(xrange);
end
% if graphing data that is within zeroTol, set to zero, create report_series and
% get line:
thedata = ds.data;
stz = bsxfun(@and, ...
bsxfun(@lt, thedata, o.zeroTol), ...
bsxfun(@gt, thedata, -o.zeroTol));
if any(stz)
thedata(stz) = 0;
end
thedata = setDataToZeroFromZeroTol(o, ds);
fprintf(fid, '%%series %s\n\\addplot', o.data.name{:});
writeLineOptions(o, fid);
fprintf(fid,'\ntable[row sep=crcr]{\nx y\\\\\n');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment