diff --git a/doc/dynare.texi b/doc/dynare.texi index 970c8d9c2..b62056b63 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -8466,7 +8466,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal @end defmethod @anchor{addSeries} -@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, zerotol +@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol Adds a @code{Series} to a @code{Graph} or a @code{Table}. @optionshead @table @code @@ -8524,6 +8524,11 @@ zero. Default: @code{`red'} The color to use when marking Table data that is greater than zero. Default: @code{`blue'} +@item tableSubSectionHeader, @code{STRING} +A header for a subsection of the table. No data will be associated +with it. It is equivalent to adding an empty series with a +name. Default: @code{''} + @item zerotol, @code{DOUBLE} The zero tolerance. Anything smaller than @code{zerotol} and larger than @code{-zerotol} will be set to zero before being diff --git a/matlab/reports/@series/series.m b/matlab/reports/@series/series.m index 30f8e462f..ce30bf417 100644 --- a/matlab/reports/@series/series.m +++ b/matlab/reports/@series/series.m @@ -49,6 +49,7 @@ o.tableNegColor = 'red'; o.tablePosColor = 'blue'; o.tableMarkerLimit = 1e-4; +o.tableSubSectionHeader = ''; o.tableAlignRight = false; o.tableRowColor = 'white'; diff --git a/matlab/reports/@series/write.m b/matlab/reports/@series/write.m index f626b47ae..586c7125d 100644 --- a/matlab/reports/@series/write.m +++ b/matlab/reports/@series/write.m @@ -37,8 +37,11 @@ assert(isa(dates, 'dynDates')); assert(isint(precision)); %% Validate options provided by user -assert(~isempty(o.data) && isa(o.data, 'dynSeries'), ... - '@series.write: must provide data as a dynSeries'); +assert(ischar(o.tableSubSectionHeader), '@series.write: tableSubSectionHeader must be a string'); +if isempty(o.tableSubSectionHeader) + assert(~isempty(o.data) && isa(o.data, 'dynSeries'), ... + '@series.write: must provide data as a dynSeries'); +end assert(ischar(o.tableNegColor), '@series.write: tableNegColor must be a string'); assert(ischar(o.tablePosColor), '@series.write: tablePosColor must be a string'); @@ -54,6 +57,14 @@ fprintf(fid, '%% Table Row (series)\n'); if ~isempty(o.tableRowColor) fprintf(fid, '\\rowcolor{%s}', o.tableRowColor); end +if ~isempty(o.tableSubSectionHeader) + fprintf(fid, '%s', o.tableSubSectionHeader); + for i=1:size(dates) + fprintf(fid, ' & '); + end + fprintf(fid, '\\\\%%\n'); + return; +end if o.tableAlignRight fprintf(fid, '\\multicolumn{1}{r}{'); end