This is a static copy of a profile reportHome
scribe/private/get_legendable_children (13 calls, 0.153 sec)
Generated 05-Aug-2011 13:02:24 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/scribe/private/get_legendable_children.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 |
36 | goodkid(k) = islegendable(h); | 51 | 0.109 s | 71.4% |  |
10 | legkids = get(ax,'Children'); | 13 | 0.033 s | 21.4% |  |
28 | legkids = expandLegendChildren... | 13 | 0.011 s | 7.1% |  |
52 | ch = flipud(legkids(goodkid)); | 13 | 0 s | 0% |  |
47 | end | 51 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.153 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
43 | The variable 'scattergrouplist' appears to change size on every loop iteration. Consider preallocating for speed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 52 |
Non-code lines (comments, blank lines) | 22 |
Code lines (lines that can run) | 30 |
Code lines that did run | 13 |
Code lines that did not run | 17 |
Coverage (did run/can run) | 43.33 % |
Function listing
time calls line
1 function ch=get_legendable_children(ax)
2 %GET_LEGENDABLE_CHILDREN Gets the children for a legend
3 % CH=GET_LEGENDABLE_CHILDREN(AX,INCLUDE_IMAGES) returns the
4 % legendable children for axes AX. If INCLUDE_IMAGES is true then
5 % include images in the list of legendable children.
6
7 % Copyright 2004-2010 The MathWorks, Inc.
8
9
0.03 13 10 legkids = get(ax,'Children');
11 % Take plotyy axes into account:
13 12 if isappdata(double(ax),'graphicsPlotyyPeer')
13 newAx = getappdata(double(ax),'graphicsPlotyyPeer');
14 if ~isempty(newAx) && ishandle(newAx)
15 newChil = get(newAx,'Children');
16 % The children of the axes of interest (passed in) should
17 % appear lower in the stack than those of its plotyy peer.
18 % The child stack gets flipud at the end of this function in
19 % order to return a list in creation order.
20 if ~isempty(newChil)
21 legkids = [newChil(:); legkids(:)];
22 else
23 legkids = legkids(:);
24 end
25 end
26 end
27
0.01 13 28 legkids = expandLegendChildren(legkids);
29
13 30 goodkid = true(length(legkids),1);
31 % v6-style scatter uses a special mechanism for legend
13 32 scattergrouplist = [];
33
13 34 for k=1:length(legkids)
51 35 h = legkids(k);
0.11 51 36 goodkid(k) = islegendable(h);
51 37 if ~feature('HGUsingMATLABClasses')
51 38 if goodkid(k) && isappdata(h,'scattergroup')
39 scattergroup = getappdata(h,'scattergroup');
40 if any(scattergrouplist==scattergroup)
41 goodkid(k) = false;
42 else
43 scattergrouplist(end+1) = scattergroup;
44 end
45 end
51 46 end
51 47 end
48
49 % We need to return a list of legendable children in creation order, but
50 % the axes 'Children' property returns a stack (reverse creation order).
51 % So we flip it.
13 52 ch = flipud(legkids(goodkid));