Commit d560e59a authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: add writeCSV option for graphs, #693

parent 135e4d13
......@@ -85,6 +85,8 @@ o.height = 4.5;
o.miscTikzPictureOptions = '';
o.miscTikzAxisOptions = '';
o.writeCSV = false;
if nargin == 1
assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ...
'must pass a graph object']);
......@@ -139,7 +141,7 @@ assert(isint(o.yTickLabelPrecision), '@graph.graph: o.yTickLabelPrecision must b
assert(islogical(o.yTickLabelFixed), '@graph.graph: yTickLabelFixed must be either true or false');
assert(islogical(o.yTickLabelZeroFill), '@graph.graph: yTickLabelZeroFill must be either true or false');
assert(islogical(o.yTickLabelScaled), '@graph.graph: yTickLabelScaled must be either true or false');
assert(islogical(o.writeCSV), '@graph.graph: writeCSV must be either true or false');
assert(ischar(o.shadeColor), '@graph.graph: shadeColor must be a string');
assert(ischar(o.zeroLineColor), '@graph.graph: zeroLineColor must be a string');
assert(any(strcmp(o.axisShape, {'box', 'L'})), ['@graph.graph: axisShape ' ...
......
......@@ -231,8 +231,25 @@ if o.showZeroline
o.zeroLineColor, dd.ndat);
end
if o.writeCSV
csvseries = dseries();
end
for i=1:ne
o.series{i}.writeSeriesForGraph(fid, dd);
if o.writeCSV
csvseries = [csvseries ...
o.series{i}.data(dd).set_names([...
o.series{i}.data.name{:} '_' ...
o.series{i}.graphLegendName '_' ...
o.series{i}.graphLineColor '_' ...
o.series{i}.graphLineStyle '_' ...
num2str(o.series{i}.graphLineWidth) '_' ...
o.series{i}.graphMarker '_' ...
o.series{i}.graphMarkerEdgeColor '_' ...
o.series{i}.graphMarkerFaceColor '_' ...
num2str(o.series{i}.graphMarkerSize)]) ...
];
end
if o.showLegend
le = o.series{i}.getNameForLegend();
if ~isempty(le)
......@@ -240,6 +257,9 @@ for i=1:ne
end
end
end
if o.writeCSV
csvseries.save(strrep(o.graphName, '.tex', ''), 'csv');
end
fprintf(fid, '\\end{axis}\n\\end{tikzpicture}%%');
if fclose(fid) == -1
error('@graph.writeGraphFile: closing %s\n', o.filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment