This is a static copy of a profile reportHome
hasbehavior (744 calls, 0.104 sec)
Generated 18-Mar-2011 23:32:04 using cpu time.
M-function in file /Applications/MATLAB_R2010a.app/toolbox/matlab/graphics/hasbehavior.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
33 | if ~isappdata(h,behaviorname) | 744 | 0.031 s | 30.0% |  |
24 | if ~ishghandle(h) | 744 | 0.031 s | 30.0% |  |
34 | has = true; | 744 | 0.010 s | 10.0% |  |
31 | if nargin == 2 | 744 | 0.010 s | 10.0% |  |
30 | behaviorname = [name,'_hgbehav... | 744 | 0.010 s | 10.0% |  |
All other lines | | | 0.010 s | 10.0% |  |
Totals | | | 0.104 s | 100% | |
Children (called functions)
No childrenM-Lint results
No M-Lint messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 46 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 22 |
Code lines that did run | 7 |
Code lines that did not run | 15 |
Coverage (did run/can run) | 31.82 % |
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-2005 The MathWorks, Inc.
21
744 22 error(nargchk(2,3,nargin,'struct'));
23
0.03 744 24 if ~ishghandle(h)
25 error(id('InvalidHandle'),'First argument must be a valid handle.')
26 end
744 27 if ~ischar(name)
28 error(id('InvalidName'),'Second argument must be a string name.')
29 end
0.01 744 30 behaviorname = [name,'_hgbehavior'];
0.01 744 31 if nargin == 2
32 % if the appdata does not exist then the behavior is true
0.03 744 33 if ~isappdata(h,behaviorname)
0.01 744 34 has = true;
35 elseif isequal(false,getappdata(h,behaviorname))
36 has = false;
37 else
38 has = true;
39 end
40 else
41 if ~islogical(state) && ~isnumeric(state)
42 error(id('InvalidBehaviorState'),...
43 'Behavior state must be logical or numeric.');
44 end
45 setappdata(h,behaviorname,state)
46 end
Other subfunctions in this file are not included in this listing.