This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
islegendablefunction434
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
if ~isappdata(h,behaviorname)
4340.006 s44.1%
24
if ~ishghandle(h)
4340.003 s20.2%
30
behaviorname = [name,'_hgbehav...
4340.002 s13.3%
45
end
4340.000 s2.4%
31
if nargin == 2
4340.000 s2.0%
All other lines  0.002 s18.0%
Totals  0.014 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function45
Non-code lines (comments, blank lines)23
Code lines (lines that can run)22
Code lines that did run11
Code lines that did not run11
Coverage (did run/can run)50.00 %
Function listing
time 
Calls 
 line
   1 
function has=hasbehavior(h,name,state)
   2 
%HASBEHAVIOR sets(enables/disables) or gets behaviors of hg objects
   3 
%
   4 
% HASBEHAVIOR(H,NAME,STATE) sets the behavior named NAME for the 
   5 
% hg object with handle H to STATE (true or false). The NAME
   6 
% is case-insensitive. The name 'legend' is used by the LEGEND
   7 
% command to enable or disable showing the object in a legend.
   8 
% HAS = HASBEHAVIOR(H,NAME) returns the boolean value for the
   9 
% behavior NAME of H.  If the behavior has not been previously 
  10 
% set for H, then 'on' is returned. 
  11 
%
  12 
%   Examples:
  13 
%       ax=axes;
  14 
%       l=plot(rand(3,3));
  15 
%       hasbehavior(l(1),'legend',false); % line will not be in legend
  16 
%       hasbehavior(l(2),'legend',true); % line will be in legend
  17 
%
  18 
%       linelegendable = hasbehavior(l(1),'legend'); % gets legend behavior
  19 
 
  20 
%   Copyright 1984-2012 The MathWorks, Inc.
  21 

< 0.001 
    434 
  22
narginchk(2,3); 
  23 

  0.003 
    434 
  24
if ~ishghandle(h) 
  25 
    error(message('MATLAB:hasbehavior:InvalidHandle'));
< 0.001 
    434 
  26
end 
< 0.001 
    434 
  27
if ~ischar(name) 
  28 
    error(message('MATLAB:hasbehavior:InvalidName'));
< 0.001 
    434 
  29
end 
  0.002 
    434 
  30
behaviorname = [name,'_hgbehavior']; 
< 0.001 
    434 
  31
if nargin == 2 
  32 
    % if the appdata does not exist then the behavior is true
  0.006 
    434 
  33
    if ~isappdata(h,behaviorname) 
< 0.001 
    434 
  34
        has = true; 
  35 
    elseif isequal(false,getappdata(h,behaviorname))
  36 
        has = false;
  37 
    else
  38 
        has = true;
< 0.001 
    434 
  39
    end 
  40 
else
  41 
    if ~islogical(state) && ~isnumeric(state)
  42 
        error(message('MATLAB:hasbehavior:InvalidBehaviorState'));
  43 
    end
  44 
    setappdata(h,behaviorname,state)
< 0.001 
    434 
  45
end 

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