Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
reporting
Commits
d0cabbed
Commit
d0cabbed
authored
Jul 30, 2014
by
Houtan Bastani
Browse files
reporting: tables: add row highlighting option
parent
2e4d6694
Changes
3
Hide whitespace changes
Inline
Side-by-side
@report_series/writeSeriesForTable.m
View file @
d0cabbed
function
o
=
writeSeriesForTable
(
o
,
fid
,
dates
,
precision
,
ncols
)
%function o = writeSeriesForTable(o, fid, dates, precision, ncols)
function
o
=
writeSeriesForTable
(
o
,
fid
,
dates
,
precision
,
ncols
,
rowcolor
)
%function o = writeSeriesForTable(o, fid, dates, precision, ncols
, rowcolor
)
% Write Table Row
%
% INPUTS
...
...
@@ -8,6 +8,7 @@ function o = writeSeriesForTable(o, fid, dates, precision, ncols)
% dates [dates] dates for report_series slice
% precision [float] precision with which to print the data
% ncols [int] total number of columns in table
% rowcolor [string] string to color this row
%
%
% OUTPUTS
...
...
@@ -65,7 +66,11 @@ assert(isfloat(o.tableMarkerLimit), '@report_series.writeSeriesForTable: tableMa
%% Write Output
fprintf
(
fid
,
'%% Table Row (report_series)\n'
);
if
~
isempty
(
o
.
tableRowColor
)
if
~
isempty
(
o
.
tableRowColor
)
&&
~
strcmpi
(
o
.
tableRowColor
,
'white'
)
fprintf
(
fid
,
'\\rowcolor{%s}'
,
o
.
tableRowColor
);
elseif
~
isempty
(
rowcolor
)
fprintf
(
fid
,
'\\rowcolor{%s}'
,
rowcolor
);
else
fprintf
(
fid
,
'\\rowcolor{%s}'
,
o
.
tableRowColor
);
end
if
~
isempty
(
o
.
tableSubSectionHeader
)
...
...
@report_table/report_table.m
View file @
d0cabbed
...
...
@@ -51,6 +51,8 @@ o.range = {};
o
.
precision
=
1
;
o
.
writeCSV
=
false
;
o
.
highlightRows
=
{
''
};
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'report_table'
),[
'With one arg to Report_Table constructor, '
...
'you must pass a report_table object'
]);
...
...
@@ -117,6 +119,7 @@ assert(iscellstr(o.titleFormat), ...
assert
(
ischar
(
o
.
tableName
),
'@report_table.report_table: tableName must be a string'
);
assert
(
ischar
(
o
.
tableDirName
),
'@report_table.report_table: tableDirName must be a string'
);
assert
(
islogical
(
o
.
writeCSV
),
'@report_table.report_table: writeCSV must be either true or false'
);
assert
(
iscellstr
(
o
.
highlightRows
),
'@report_table.report_table: highlightRowsmust be a cell string'
);
% using o.seriesToUse, create series objects and put them in o.series
if
~
isempty
(
o
.
data
)
...
...
@report_table/writeTableFile.m
View file @
d0cabbed
...
...
@@ -175,7 +175,7 @@ if o.writeCSV
csvseries
=
dseries
();
end
for
i
=
1
:
ne
o
.
series
{
i
}
.
writeSeriesForTable
(
fid
,
o
.
range
,
o
.
precision
,
ncols
);
o
.
series
{
i
}
.
writeSeriesForTable
(
fid
,
o
.
range
,
o
.
precision
,
ncols
,
o
.
highlightRows
{
mod
(
i
,
length
(
o
.
highlightRows
))
+
1
}
);
if
o
.
writeCSV
if
isempty
(
o
.
series
{
i
}
.
tableSubSectionHeader
)
csvseries
=
[
csvseries
...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment