reporting: make vlineAfter accept a cell array of dates
parent
91f408b6b9
commit
f47555a92f
|
@ -12,7 +12,7 @@ function o = report_table(varargin)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
% Copyright (C) 2013-2014 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -71,6 +71,10 @@ elseif nargin > 1
|
|||
end
|
||||
end
|
||||
|
||||
if isa(o.vlineAfter, 'dates')
|
||||
o.vlineAfter = {o.vlineAfter};
|
||||
end
|
||||
|
||||
% Check options provided by user
|
||||
assert(ischar(o.title), '@report_table.report_table: title must be a string');
|
||||
assert(islogical(o.showHlines), '@report_table.report_table: showHlines must be true or false');
|
||||
|
@ -83,7 +87,7 @@ assert(isempty(o.data) || isa(o.data, 'dseries'), ...
|
|||
'@report_table.report_table: data must be a dseries');
|
||||
assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ...
|
||||
'@report_table.report_table: seriesToUse must be a cell array of string(s)');
|
||||
assert(isempty(o.vlineAfter) || isa(o.vlineAfter, 'dates'), ...
|
||||
assert(isempty(o.vlineAfter) || allCellsAreDates(o.vlineAfter), ...
|
||||
'@report_table.report_table: vlineAfter must be a dates');
|
||||
if o.showVlines
|
||||
o.vlineAfter = '';
|
||||
|
|
|
@ -64,9 +64,11 @@ for i=1:ndates
|
|||
end
|
||||
end
|
||||
if ~isempty(o.vlineAfter)
|
||||
if dates(i) == o.vlineAfter
|
||||
if ~(o.vlineAfterEndOfPeriod && dates(i).time(2) == dates(i).freq)
|
||||
fprintf(fid, '|');
|
||||
for j=1:length(o.vlineAfter)
|
||||
if dates(i) == o.vlineAfter{j}
|
||||
if ~(o.vlineAfterEndOfPeriod && dates(i).time(2) == dates(i).freq)
|
||||
fprintf(fid, '|');
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
function tf = allCellsAreDates(dcell)
|
||||
%function tf = allCellsAreDates(dcell)
|
||||
% Determines if all the elements of dcell are dates objects
|
||||
%
|
||||
% INPUTS
|
||||
% dcell cell of dates objects
|
||||
%
|
||||
% OUTPUTS
|
||||
% tf true if every entry of dcell is a dates object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% 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/>.
|
||||
|
||||
assert(iscell(dcell));
|
||||
tf = true;
|
||||
for i=1:length(dcell)
|
||||
if ~isa(dcell{i}, 'dates')
|
||||
tf = false;
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue