Select Git revision
SteadyState.jl
Forked from
Dynare / dynare
Source project has a limited visibility.
writeTableFile.m 7.13 KiB
function tableName = writeTableFile(o, pg, sec, row, col)
%function tableName = writeTableFile(o, pg, sec, row, col)
% Write a Report_Table object
%
% INPUTS
% o [report_table] report_table object
% pg [integer] this page number
% sec [integer] this section number
% row [integer] this row number
% col [integer] this col number
%
% OUTPUTS
% tableName [string] name of table written
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2013-2019 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/>.
ne = length(o.series);
is_data_table = ~isempty(o.table_data);
if ne == 0 && ~is_data_table
warning('@report_table.write: no series to plot, returning');
return
end
if isempty(o.tableName)
tableName = sprintf('%s/table_pg%d_sec%d_row%d_col%d.tex', o.tableDirName, pg, sec, row, col);
else
tableName = [o.tableDirName '/' o.tableName];
end
[fid, msg] = fopen(tableName, 'w');
if fid == -1
error(['@report_table.writeTableFile: ' msg]);
end
fprintf(fid, '%% Report_Table Object written %s\n', datestr(now));
fprintf(fid, '\\begin{tabular}[t]{l}\n');
fprintf(fid, '\\setlength{\\parindent}{6pt}\n');
fprintf(fid, '\\setlength{\\tabcolsep}{4pt}\n');
%number of left-hand columns, 1 until we allow the user to group data,
% e.g.: GDP Europe
% GDP France
% GDP Germany
% this example would be two lh columns, with GDP Europe spanning both
nlhc = 1;
if ~is_data_table
fprintf(fid, '\\begin{tabular}{@{}l');
if isempty(o.range)
dates = getMaxRange(o.series);
o.range = {dates};
else
dates = o.range{1};