This is a static copy of a profile report

Home

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)

Function NameFunction TypeCalls
graph2dhelperfunction13
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
36
goodkid(k) = islegendable(h);
510.109 s71.4%
10
legkids = get(ax,'Children');
130.033 s21.4%
28
legkids = expandLegendChildren...
130.011 s7.1%
52
ch = flipud(legkids(goodkid));
130 s0%
47
end
510 s0%
All other lines  0 s0%
Totals  0.153 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
scribe/private/islegendablefunction510.109 s71.4%
scribe/private/expandLegendChildrenfunction130.011 s7.1%
flipudfunction130 s0%
Self time (built-ins, overhead, etc.)  0.033 s21.4%
Totals  0.153 s100% 
Code Analyzer results
Line numberMessage
43The variable 'scattergrouplist' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
[ Show coverage for parent directory ]
Total lines in function52
Non-code lines (comments, blank lines)22
Code lines (lines that can run)30
Code lines that did run13
Code lines that did not run17
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));