This is a static copy of a profile report

Home

Function details for newplot>ObserveAxesNextPlotThis is a static copy of a profile report

Home

newplot>ObserveAxesNextPlot (Calls: 2, Time: 0.014 s)
Generated 01-May-2020 20:23:09 using performance time.
subfunction in file /Applications/MATLAB_R2018a.app/toolbox/matlab/graphics/newplot.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
newplotfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
148
cla(ax, 'reset', hsave);
20.012 s88.2%
147
if (ax.prepareForPlot())
20.000 s2.8%
134
if ~strcmp(fig.Type,'figure')
20.000 s1.8%
133
fig = ax.Parent;
20.000 s1.7%
158
if ~any(ishghandle(ax)) &&...
20.000 s1.3%
All other lines  0.001 s4.2%
Totals  0.014 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
clafunction20.011 s81.8%
Self time (built-ins, overhead, etc.)  0.003 s18.2%
Totals  0.014 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function41
Non-code lines (comments, blank lines)16
Code lines (lines that can run)25
Code lines that did run9
Code lines that did not run16
Coverage (did run/can run)36.00 %
Function listing
time 
Calls 
 line
 124 
function ax = ObserveAxesNextPlot(ax, hsave)
 125 
%
 126 
% Helper fcn for preparing axes for nextplot, optionally
 127 
% preserving specific existing descendants
 128 
% GUARANTEED to return an axes in the same figure as the passed-in
 129 
% axes, even if that axes gets deleted by an overzealous create or
 130 
% delete fcn anywhere in the figure.
 131 

 132 
% for performance only call ancestor when needed
< 0.001 
      2 
 133
fig = ax.Parent; 
< 0.001 
      2 
 134
if ~strcmp(fig.Type,'figure') 
 135 
    fig = ancestor(fig,'figure');
 136 
end
 137 

< 0.001 
      2 
 138
switch ax.NextPlot 
< 0.001 
      2 
 139
    case 'replaceall' 
 140 
        cla(ax, 'reset', hsave);
< 0.001 
      2 
 141
    case 'replace' 
 142 
        % If there are multiple data spaces, ax.prepareForPlot() will do a
 143 
        % reset of the properties for the active data space (while
 144 
        % preserving other data spaces) and return false to indicate that a
 145 
        % full reset is not necessary. Otherwise, ax.prepareForPlot() will
 146 
        % return true.
< 0.001 
      2 
 147
        if (ax.prepareForPlot()) 
  0.012 
      2 
 148
            cla(ax, 'reset', hsave); 
 149 
        else
 150 
            cla(ax, hsave);
< 0.001 
      2 
 151
        end 
 152 
    case 'replacechildren'
 153 
        cla(ax, hsave);
 154 
    case 'add'
 155 
        % nothing
 156 
end
 157 

< 0.001 
      2 
 158
if ~any(ishghandle(ax)) && isempty(hsave) 
 159 
    if ~any(ishghandle(fig))
 160 
        ax = axes;
 161 
    else
 162 
        ax = axes('Parent',fig);
 163 
    end
 164 
end

Other subfunctions in this file are not included in this listing.