This is a static copy of a profile report

Home

convertDistances (Calls: 46, Time: 0.011 s)
Generated 16-Jul-2020 17:09:02 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/graphics/+matlab/+graphics/+internal/convertDistances.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...Manager>AxesLayoutManager.doUpdateclass method46
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
14
viewport.Units = fromunits;
460.004 s34.6%
15
viewport.Position = [0, 0, dis...
460.002 s13.5%
25
viewport.Position = [0, 0, dis...
460.001 s9.2%
18
viewport.Units = tounits;
460.001 s7.5%
24
viewport.Units = fromunits;
460.001 s7.2%
All other lines  0.003 s28.1%
Totals  0.011 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function36
Non-code lines (comments, blank lines)26
Code lines (lines that can run)10
Code lines that did run10
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
Calls 
 line
   1 
function todists = convertDistances(viewport, tounits, fromunits, distances)
   2 
% This is an undocumented function and may be removed in a future release.
   3 

   4 
% Use the matlab.graphics.general.UnitPosition object "viewport" to convert
   5 
% the units of "distances" from "fromunits" to "tounits".
   6 
%
   7 
% "distances" are [left bottom right top]. Unlike positions, pixel based
   8 
% distances are not 1-based. In order to do the conversion correctly,
   9 
% perform two conversions: once for left/bottom, and once for right/top.
  10 

  11 
%   Copyright 2018 The MathWorks, Inc.
  12 

  13 
% Set the 'Units' and 'Position' to the starting units and position.
  0.004 
     46 
  14
viewport.Units = fromunits; 
  0.002 
     46 
  15
viewport.Position = [0, 0, distances(1:2)]; 
  16 

  17 
% Set the 'Units' to the new units, this will trigger a unit conversion.
< 0.001 
     46 
  18
viewport.Units = tounits; 
  19 

  20 
% Read back the new position in the new units.
< 0.001 
     46 
  21
leftbottom = viewport.Position; 
  22 

  23 
% Set the 'Units' and 'Position' to the starting units and position.
< 0.001 
     46 
  24
viewport.Units = fromunits; 
  0.001 
     46 
  25
viewport.Position = [0, 0, distances(3:4)]; 
  26 

  27 
% Set the 'Units' to the new units, this will trigger a unit conversion.
< 0.001 
     46 
  28
viewport.Units = tounits; 
  29 

  30 
% Read back the new position in the new units.
< 0.001 
     46 
  31
righttop = viewport.Position; 
  32 

  33 
% Merge the outputs
< 0.001 
     46 
  34
todists = [leftbottom(3:4), righttop(3:4)]; 
  35 

< 0.001 
     46 
  36
end 

Other subfunctions in this file are not included in this listing.