This is a static copy of a profile report

Home

subplot>addAxesToGrid (Calls: 4, Time: 0.039 s)
Generated 18-May-2021 16:05:23 using performance time.
subfunction in file /usr/local/MATLAB/R2021a/toolbox/matlab/graph2d/subplot.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
subplotfunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
671
lm.addToListeners(ax,[]);
40.012 s32.0%
665
lm =  matlab.graphics.internal...
10.012 s30.2%
660
grid = gobjects(nRows,nCols);
10.005 s11.9%
676
dlm =  matlab.graphics.interna...
40.003 s7.1%
677
dlm.addToListeners(ax);
40.001 s3.3%
All other lines  0.006 s15.5%
Totals  0.039 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...ubplotListenersManager.addToListenersclass method40.012 s30.1%
gobjectsfunction10.004 s11.5%
...DeleteListenersManager.addToListenersclass method40.001 s1.8%
...tenersManager.SubplotListenersManagerclass method10.000 s1.0%
...Manager.SubplotDeleteListenersManagerclass method40.000 s0.3%
Self time (built-ins, overhead, etc.)  0.021 s55.4%
Totals  0.039 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function43
Non-code lines (comments, blank lines)12
Code lines (lines that can run)31
Code lines that did run29
Code lines that did not run2
Coverage (did run/can run)93.55 %
Function listing
time 
Calls 
 line
 656 
function addAxesToGrid(ax, nRows, nCols, row, col, position, plotId)
< 0.001 
      4 
 657
    p = ax.Parent; 
< 0.001 
      4 
 658
    grid = getappdata(p, 'SubplotGrid'); 
< 0.001 
      4 
 659
    if isempty(grid) 
  0.005 
      1 
 660
        grid = gobjects(nRows,nCols); 
< 0.001 
      4 
 661
    end 
 662 
    
 663 
    % add SubplotListenersManager to p
< 0.001 
      4 
 664
    if ~isappdata(p,'SubplotListenersManager') 
  0.012 
      1 
 665
        lm =  matlab.graphics.internal.SubplotListenersManager(nRows*nCols); 
 666 
        % create an empty filed so that other tests wont complain
< 0.001 
      1 
 667
        setappdata(p,'SubplotListeners',[]); 
< 0.001 
      3 
 668
    else 
< 0.001 
      3 
 669
        lm=getappdata(p,'SubplotListenersManager'); 
< 0.001 
      4 
 670
    end 
  0.012 
      4 
 671
    lm.addToListeners(ax,[]); 
< 0.001 
      4 
 672
    setappdata(p,'SubplotListenersManager',lm); 
 673 
    
 674 
    % add SubplotDeleteListenersManager to axes
< 0.001 
      4 
 675
    if ~isappdata(ax,'SubplotDeleteListenersManager') 
  0.003 
      4 
 676
        dlm =  matlab.graphics.internal.SubplotDeleteListenersManager(); 
  0.001 
      4 
 677
        dlm.addToListeners(ax); 
< 0.001 
      4 
 678
        setappdata(ax,'SubplotDeleteListenersManager',dlm);  
< 0.001 
      4 
 679
    end 
 680 
    
< 0.001 
      4 
 681
    setappdata(ax,'SubplotGridLocation',{nRows,nCols,plotId}) 
< 0.001 
      4 
 682
    setappdata(ax, 'SubplotPosition', position); % normalized 
< 0.001 
      4 
 683
    subplotlayoutInvalid(handle(ax), [], p); 
 684 
    
 685 
    %when subplot is not in a single grid cell for the current grid,
 686 
    %don't add it to the auto-layout
  0.001 
      4 
 687
    if any(size(grid) ~= [nRows, nCols]) ... %active grid shape does not match n,m 
      4 
 688
            || length(row) ~= 1 || length(col) ~= 1 ... %multi-cell subplot 
      4 
 689
            || round(row) ~= row || round(col) ~= col ... %non-integer cell specified 
      4 
 690
            || grid(row + 1, col + 1) == ax %axes is already in cell m,n,p 
 691 
        addAxesToSpanGrid(ax, nRows, nCols, row, col);
 692 
        return
< 0.001 
      4 
 693
    end 
 694 
    
 695 
    % only add axes to grid if it doesn't span multiple columns or rows
< 0.001 
      4 
 696
    grid(row + 1, col + 1) = ax; 
< 0.001 
      4 
 697
    setappdata(p,  'SubplotGrid', grid) 
  0.001 
      4 
 698
end 

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