reporting: make zerotol work for both graphs and reports
parent
bc2274e08a
commit
0f61ae941a
|
@ -36,7 +36,7 @@ dataString = sprintf('%%.%df', precision);
|
||||||
precision = 10^precision;
|
precision = 10^precision;
|
||||||
|
|
||||||
data = dser(dates);
|
data = dser(dates);
|
||||||
data = data.data;
|
data = setDataToZeroFromZeroTol(o, data);
|
||||||
for i=1:size(data,1)
|
for i=1:size(data,1)
|
||||||
fprintf(fid, '&');
|
fprintf(fid, '&');
|
||||||
if o.tableShowMarkers
|
if o.tableShowMarkers
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
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
|
|
@ -105,16 +105,7 @@ else
|
||||||
ds = o.data(xrange);
|
ds = o.data(xrange);
|
||||||
end
|
end
|
||||||
|
|
||||||
% if graphing data that is within zeroTol, set to zero, create report_series and
|
thedata = setDataToZeroFromZeroTol(o, ds);
|
||||||
% 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
|
|
||||||
|
|
||||||
fprintf(fid, '%%series %s\n\\addplot', o.data.name{:});
|
fprintf(fid, '%%series %s\n\\addplot', o.data.name{:});
|
||||||
writeLineOptions(o, fid);
|
writeLineOptions(o, fid);
|
||||||
fprintf(fid,'\ntable[row sep=crcr]{\nx y\\\\\n');
|
fprintf(fid,'\ntable[row sep=crcr]{\nx y\\\\\n');
|
||||||
|
|
Loading…
Reference in New Issue