reporting: add writeCSV option for tables. closes #693
parent
54adbb1e69
commit
2cbe1c34d9
|
@ -49,6 +49,7 @@ o.data = '';
|
|||
o.seriesToUse = '';
|
||||
o.range = {};
|
||||
o.precision = 1;
|
||||
o.writeCSV = false;
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'report_table'),['With one arg to Report_Table constructor, ' ...
|
||||
|
@ -115,6 +116,7 @@ assert(iscellstr(o.titleFormat), ...
|
|||
'@report_table.report_table: titleFormat must be a cell array of string(s)');
|
||||
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');
|
||||
|
||||
% using o.seriesToUse, create series objects and put them in o.series
|
||||
if ~isempty(o.data)
|
||||
|
|
|
@ -171,13 +171,26 @@ fprintf(fid, '\\hline%%\n');
|
|||
fprintf(fid, '%%\n');
|
||||
|
||||
% Write Report_Table Data
|
||||
if o.writeCSV
|
||||
csvseries = dseries();
|
||||
end
|
||||
for i=1:ne
|
||||
o.series{i}.writeSeriesForTable(fid, o.range, o.precision, ncols);
|
||||
if o.writeCSV
|
||||
if isempty(o.series{i}.tableSubSectionHeader)
|
||||
csvseries = [csvseries ...
|
||||
o.series{i}.data(dates).set_names([...
|
||||
num2str(i) '_' ...
|
||||
o.series{i}.data.name{:}])];
|
||||
end
|
||||
end
|
||||
if o.showHlines
|
||||
fprintf(fid, '\\hline\n');
|
||||
end
|
||||
end
|
||||
|
||||
if o.writeCSV
|
||||
csvseries.save(strrep(o.tableName, '.tex', ''), 'csv');
|
||||
end
|
||||
fprintf(fid, '\\bottomrule\n');
|
||||
fprintf(fid, '\\end{tabular}\\setlength{\\parindent}{0pt}\n \\par \\medskip\n\n');
|
||||
fprintf(fid, '%% End Report_Table Object\n');
|
||||
|
|
Loading…
Reference in New Issue