This is a static copy of a profile reportHome
getpixelposition (93 calls, 0.000 sec)
Generated 05-Aug-2011 13:03:20 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/uitools/getpixelposition.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
46 | if recursive && ~ishgh... | 93 | 0 s | 0% |  |
43 | position = hgconvertunits(ance... | 93 | 0 s | 0% |  |
38 | parent = get(h,'Parent'); | 93 | 0 s | 0% |  |
36 | end | 93 | 0 s | 0% |  |
35 | recursive = false; | 93 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0 s | 0% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 49 |
Non-code lines (comments, blank lines) | 36 |
Code lines (lines that can run) | 13 |
Code lines that did run | 8 |
Code lines that did not run | 5 |
Coverage (did run/can run) | 61.54 % |
Function listing
time calls line
1 function position = getpixelposition(h,recursive)
2 % GETPIXELPOSITION Get the position of an HG object in pixel units.
3 % GETPIXELPOSITION(HANDLE) gets the position of the object specified by
4 % HANDLE in pixel units.
5 %
6 % GETPIXELPOSITION(HANDLE, RECURSIVE) gets the position as above. If
7 % RECURSIVE is true, the returned position is relative to the parent
8 % figure of HANDLE.
9 %
10 % POSITION = GETPIXELPOSITION(...) returns the pixel position in POSITION.
11 %
12 % Example:
13 % f = figure;
14 % p = uipanel('Position', [.2 .2 .6 .6]);
15 % h1 = uicontrol(p, 'Units', 'normalized', 'Position', [.1 .1 .5 .2]);
16 % % Get pixel position w.r.t the parent uipanel
17 % pos1 = getpixelposition(h1)
18 % % Get pixel position w.r.t the parent figure using the recursive flag
19 % pos2 = getpixelposition(h1, true)
20 %
21 % See also SETPIXELPOSITION, UICONTROL, UIPANEL
22
23 % Copyright 1984-2006 The MathWorks, Inc.
24 % $Revision: 1.1.6.9 $ $Date: 2008/08/01 12:23:31 $
25
26 % Verify that getpixelposition is given between 1 and 2 arguments
93 27 error(nargchk(1, 2, nargin, 'struct'))
28
29 % Verify that "h" is a handle
93 30 if ~ishghandle(h)
31 error('MATLAB:getpixelposition:InvalidHandle', 'Input argument "h" must be a HANDLE')
32 end
33
93 34 if nargin < 2
93 35 recursive = false;
93 36 end
37
93 38 parent = get(h,'Parent');
39
40 % Use hgconvertunits to get the position in pixels (avoids recursion
41 % due to unit changes trigering resize events which re-call
42 % getpixelposition)
93 43 position = hgconvertunits(ancestor(h,'figure'),get(h,'Position'),get(h,'Units'),...
44 'Pixels',parent);
45
93 46 if recursive && ~ishghandle(h,'figure') && ~ishghandle(parent,'figure')
47 parentPos = getpixelposition(parent, recursive);
48 position = position + [parentPos(1) parentPos(2) 0 0];
49 end
Other subfunctions in this file are not included in this listing.