This is a static copy of a profile reportHome
scribe/private/get_legendable_children (2 calls, 0.342 sec)
Generated 18-Mar-2011 23:31:54 using cpu time.
M-function in file /Applications/MATLAB_R2010a.app/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 |
38 | goodkid(k) = islegendable(h,in... | 372 | 0.249 s | 72.7% |  |
30 | legkids = expandLegendChildren... | 2 | 0.073 s | 21.2% |  |
37 | h = legkids(k); | 372 | 0.010 s | 3.0% |  |
15 | legkids = get(ax,'Children'); | 2 | 0.010 s | 3.0% |  |
52 | ch = flipud(legkids(goodkid)); | 2 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.342 s | 100% | |
Children (called functions)
M-Lint results
Line number | Message |
44 | 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) | 23 |
Code lines (lines that can run) | 29 |
Code lines that did run | 14 |
Code lines that did not run | 15 |
Coverage (did run/can run) | 48.28 % |
Function listing
time calls line
1 function ch=get_legendable_children(ax, includeImages)
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-2007 The MathWorks, Inc.
8
9 % Note: It appears this property is never created nor set anywhere. This
10 % conditional may be safe to remove.
2 11 if isprop(handle(ax),'legendableChildren')
12 legkids = get(handle(ax),'legendableChildren');
13 legkids = legkids(:);
2 14 else
0.01 2 15 legkids = get(ax,'Children');
16 % Take plotyy axes into account:
2 17 if isappdata(double(ax),'graphicsPlotyyPeer')
18 newAx = getappdata(double(ax),'graphicsPlotyyPeer');
19 if ~isempty(newAx) && ishandle(newAx)
20 newChil = get(newAx,'Children');
21 % The children of the axes of interest (passed in) should
22 % appear lower in the stack than those of its plotyy peer.
23 % The child stack gets flipud at the end of this function in
24 % order to return a list in creation order.
25 legkids = [newChil(:); legkids(:)];
26 end
27 end
2 28 end
29
0.07 2 30 legkids = expandLegendChildren(legkids);
31
2 32 goodkid = true(length(legkids),1);
33 % v6-style scatter uses a special mechanism for legend
2 34 scattergrouplist = [];
35
2 36 for k=1:length(legkids)
0.01 372 37 h = legkids(k);
0.25 372 38 goodkid(k) = islegendable(h,includeImages);
372 39 if goodkid(k) && isappdata(h,'scattergroup')
40 scattergroup = getappdata(h,'scattergroup');
41 if any(scattergrouplist==scattergroup)
42 goodkid(k) = false;
43 else
44 scattergrouplist(end+1) = scattergroup;
45 end
46 end
372 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.
2 52 ch = flipud(legkids(goodkid));