This is a static copy of a profile report

Home

hold (Calls: 56, Time: 0.052 s)
Generated 16-Jul-2020 17:08:47 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/graphics/axis/hold.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
hhsave_VFI_3OCfunction56
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
30
isaxarr=matlab.graphics.chart....
560.009 s17.6%
63
matlab.graphics.internal.markF...
560.009 s17.6%
36
[ax,args,nargs] = axescheck(va...
560.006 s12.3%
64
fig = get(ax,'Parent');
560.004 s8.4%
54
ax = gca;
560.004 s6.9%
All other lines  0.019 s37.2%
Totals  0.052 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
markFigurefunction560.009 s16.7%
objArrayDispatchfunction560.007 s13.6%
axescheckfunction560.006 s10.6%
Self time (built-ins, overhead, etc.)  0.031 s59.2%
Totals  0.052 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function101
Non-code lines (comments, blank lines)48
Code lines (lines that can run)53
Code lines that did run32
Code lines that did not run21
Coverage (did run/can run)60.38 %
Function listing
time 
Calls 
 line
   1 
function hold(varargin)
   2 
%HOLD   Hold current graph
   3 
%   HOLD ON holds the current plot and all axis properties, including 
   4 
%   the current color and linestyle, so that subsequent graphing commands
   5 
%   add to the existing graph without resetting the color and linestyle.
   6 
%   HOLD OFF returns to the default mode whereby PLOT commands erase 
   7 
%   the previous plots and reset all axis properties before drawing 
   8 
%   new plots.
   9 
%   HOLD, by itself, toggles the hold state.
  10 
%   HOLD does not affect axis autoranging properties.
  11 
%
  12 
%   HOLD ALL is the same as HOLD ON. This syntax will be removed in 
  13 
%   a future release. Use HOLD ON instead.
  14 
%
  15 
%   HOLD(AX,...) applies the command to the Axes object AX.
  16 
%
  17 
%   Algorithm note:
  18 
%   HOLD ON sets the NextPlot property of the current figure and
  19 
%   axes to "add".
  20 
%   HOLD OFF sets the NextPlot property of the current axes to
  21 
%   "replace".
  22 
%
  23 
%   See also ISHOLD, NEWPLOT, FIGURE, AXES.
  24 

  25 
%   Copyright 1984-2019 The MathWorks, Inc.
  26 

  27 
% Parse possible Axes input
< 0.001 
     56 
  28
narginchk(0,2); 
  29 

  0.009 
     56 
  30
isaxarr=matlab.graphics.chart.internal.objArrayDispatch(@hold,varargin{:}); 
< 0.001 
     56 
  31
if isaxarr 
  32 
    return
< 0.001 
     56 
  33
end 
  34 

  35 
% look for leading axes (must not be a vector of handles)
  0.006 
     56 
  36
[ax,args,nargs] = axescheck(varargin{:}); 
  37 

  38 
% If "ax", returned from axescheck is empty,
  39 
% then one of the following cases is true: 
  40 
%   1. "ax" object was not passed in.
  41 
%   2. Invalid value for "ax" was passed in.
  42 
%   3. "ax" corresponds to a stand-alone chart.
  43 

< 0.001 
     56 
  44
if isempty(ax) 
  45 
    % if the ax is a standalone chart
< 0.001 
     56 
  46
    if nargs>0 && isa(args{1},'matlab.graphics.chart.Chart') 
  47 
        ax = args{1};
< 0.001 
     56 
  48
    elseif nargin == 2 
  49 
        % If 2 args were passed in and first argument is not
  50 
        % an axes object or a stand-alone chart, then throw an 
  51 
        % error.
  52 
        error(message('MATLAB:hold:InvalidFirstArg'));
< 0.001 
     56 
  53
    else  
  0.004 
     56 
  54
        ax = gca; 
< 0.001 
     56 
  55
    end     
< 0.001 
     56 
  56
end 
  57 

  0.002 
     56 
  58
if isa(ax,'matlab.graphics.chart.Chart')             
  59 
    error(message('MATLAB:hold:UnsupportedCurrentAxes',ax.Type));
< 0.001 
     56 
  60
end 
  61 

  62 

  0.009 
     56 
  63
matlab.graphics.internal.markFigure(ax); 
  0.004 
     56 
  64
fig = get(ax,'Parent'); 
  0.003 
     56 
  65
if ~strcmp(get(fig,'Type'),'figure') 
  66 
  fig = ancestor(fig,'figure');
< 0.001 
     56 
  67
end 
  68 

< 0.001 
     56 
  69
if ~isempty(args) 
< 0.001 
     56 
  70
    opt_hold_state = args{1}; 
< 0.001 
     56 
  71
end 
  72 

  0.002 
     56 
  73
nexta = get(ax,'NextPlot'); 
  0.002 
     56 
  74
nextf = get(fig,'NextPlot'); 
< 0.001 
     56 
  75
hold_state = strcmp(nexta,'add') && strcmp(nextf,'add'); 
  76 

< 0.001 
     56 
  77
replace_state = 'replace'; 
  0.001 
     56 
  78
if isa(ax,'matlab.ui.control.UIAxes') 
  79 
    replace_state = 'replacechildren';
< 0.001 
     56 
  80
end 
  81 

< 0.001 
     56 
  82
if(nargs == 0) 
  83 
    if(hold_state)
  84 
        set(ax,'NextPlot',replace_state);
  85 
        disp(getString(message('MATLAB:hold:CurrentPlotReleased')));
  86 
    else
  87 
        set(fig,'NextPlot','add');
  88 
        set(ax,'NextPlot', 'add');
  89 
        disp(getString(message('MATLAB:hold:CurrentPlotHeld')));
  90 
    end
< 0.001 
     56 
  91
elseif(strcmpi(opt_hold_state, 'on')) 
  0.003 
     56 
  92
    set(fig,'NextPlot','add'); 
  0.003 
     56 
  93
    set(ax,'NextPlot','add'); 
  94 
elseif(strcmpi(opt_hold_state, 'off'))
  95 
    set(ax,'NextPlot', replace_state);
  96 
elseif(strcmpi(opt_hold_state, 'all'))
  97 
    set(fig,'NextPlot','add');
  98 
    set(ax,'NextPlot','add');
  99 
else
 100 
    error(message('MATLAB:hold:UnknownOption'));
< 0.001 
     56 
 101
end 

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