reporting: fix figure inclusion for windows

time-shift
Houtan Bastani 2013-12-12 16:04:57 +01:00
parent 85905cbb1d
commit 99f4a01a48
3 changed files with 13 additions and 4 deletions

View File

@ -10346,7 +10346,7 @@ command. Default: @code{`!'}
@end table @end table
@end defmethod @end defmethod
@defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline @defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline
Adds a @code{Graph} to a @code{Section}. Adds a @code{Graph} to a @code{Section}.
@optionshead @optionshead
@table @code @table @code
@ -10359,6 +10359,10 @@ The @code{dseries} that provides the data for the graph. Default:
The name to use when saving this figure. Default: @code{[tempname The name to use when saving this figure. Default: @code{[tempname
`.tex']} `.tex']}
@item figDirName, @code{STRING}
The name of the folder in which to store this figure. Default:
@code{tmpFigDir}
@item graphSize, @code{NUMERICAL_VECTOR} @item graphSize, @code{NUMERICAL_VECTOR}
The width and height to be passed to the third and fourth elements of The width and height to be passed to the third and fourth elements of
the array passed to the @code{`Position'} option of Matlab's the array passed to the @code{`Position'} option of Matlab's

View File

@ -135,12 +135,11 @@ end
drawnow; drawnow;
if isempty(o.figname) if isempty(o.figname)
tn = tempname; [junk, tn] = fileparts(tempname);
if strcmp(computer, 'PCWIN') || strcmp(computer, 'PCWIN64') if strcmp(computer, 'PCWIN') || strcmp(computer, 'PCWIN64')
tn = strrep(tn, '\', '/');
tn = strrep(tn, '_', '\_'); tn = strrep(tn, '_', '\_');
end end
o.figname = [tn '.tex']; o.figname = [o.figDirName filesep tn '.tex'];
end end
disp(' converting to tex....'); disp(' converting to tex....');
if isoctave && isempty(regexpi(computer, '.*apple.*', 'once')) if isoctave && isempty(regexpi(computer, '.*apple.*', 'once'))

View File

@ -39,6 +39,7 @@ o.title = '';
o.ylabel = ''; o.ylabel = '';
o.xlabel = ''; o.xlabel = '';
o.figDirName = 'tmpFigDir';
o.figname = ''; o.figname = '';
o.data = ''; o.data = '';
o.seriesToUse = ''; o.seriesToUse = '';
@ -92,6 +93,7 @@ assert(ischar(o.title), '@graph.graph: title must be a string');
assert(ischar(o.xlabel), '@graph.graph: xlabel file must be a string'); assert(ischar(o.xlabel), '@graph.graph: xlabel file must be a string');
assert(ischar(o.ylabel), '@graph.graph: ylabel file must be a string'); assert(ischar(o.ylabel), '@graph.graph: ylabel file must be a string');
assert(ischar(o.figname), '@graph.graph: figname must be a string'); assert(ischar(o.figname), '@graph.graph: figname must be a string');
assert(ischar(o.figDirName), '@graph.graph: figDirName must be a string');
assert(islogical(o.showGrid), '@graph.graph: showGrid must be either true or false'); assert(islogical(o.showGrid), '@graph.graph: showGrid must be either true or false');
assert(islogical(o.showLegend), '@graph.graph: showLegend must be either true or false'); assert(islogical(o.showLegend), '@graph.graph: showLegend must be either true or false');
assert(islogical(o.showLegendBox), '@graph.graph: showLegendBox must be either true or false'); assert(islogical(o.showLegendBox), '@graph.graph: showLegendBox must be either true or false');
@ -150,6 +152,10 @@ end
o = rmfield(o, 'seriesToUse'); o = rmfield(o, 'seriesToUse');
o = rmfield(o, 'data'); o = rmfield(o, 'data');
if ~exist(o.figDirName, 'file')
mkdir(o.figDirName);
end
% Create graph object % Create graph object
o = class(o, 'graph'); o = class(o, 'graph');
end end