This is a static copy of a profile report

Home

gobjects (Calls: 16, Time: 0.008 s)
Generated 18-May-2021 16:05:23 using performance time.
function in file /usr/local/MATLAB/R2021a/toolbox/matlab/graphics/objectsystem/gobjects.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
subplot>addAxesToGridsubfunction1
newplotfunction10
objArrayDispatchfunction5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
94
array = repmat(matlab.graphics...
10.003 s36.6%
68
dims = [varargin{:}];
110.001 s12.1%
86
array = matlab.graphics.Graphi...
100.001 s10.3%
44
if ( ~isnumeric(varargin{1}) |...
100.000 s5.3%
33
array = matlab.graphics.Graphi...
50.000 s4.1%
All other lines  0.003 s31.5%
Totals  0.008 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
repmatfunction10.002 s26.7%
Self time (built-ins, overhead, etc.)  0.006 s73.3%
Totals  0.008 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function96
Non-code lines (comments, blank lines)52
Code lines (lines that can run)44
Code lines that did run32
Code lines that did not run12
Coverage (did run/can run)72.73 %
Function listing
time 
Calls 
 line
   1 
function array = gobjects(varargin)
   2 
%GOBJECTS    Return a default graphics object array.
   3 
%   GOBJECTS(N) returns a N-by-N matrix of default graphics objects. 
   4 
%
   5 
%   GOBJECTS(M,N) or GOBJECTS([M,N]) returns a M-by-N matrix of 
   6 
%   default graphics objects.
   7 
%
   8 
%   GOBJECTS(M,N,P,...) or GOBJECTS([M,N,P ...]) returns a 
   9 
%   M-by-N-by-P-by-... array of default graphics objects.
  10 
%
  11 
%   GOBJECTS(SIZE(A)) creates an array of default graphics objects 
  12 
%   and is the same size as A.
  13 
%
  14 
%   GOBJECTS with no arguments creates a 1-by-1 scalar default graphics 
  15 
%   object.
  16 
%
  17 
%   GOBJECTS(0) with input of zero creates a 0-by-0 empty default graphics 
  18 
%   object array.
  19 
%
  20 
%   Note: The size inputs M, N, and P... should be nonnegative integers. 
  21 
%   Negative integers are treated as 0, and non-integers are truncated. 
  22 
%
  23 
%   Example:
  24 
%      x = gobjects(2,3)      returns a 2-by-3 default graphics object array
  25 
%      x = gobjects([1,2,3])  returns a 1-by-2-by-3 default graphics object array
  26 
%
  27 
%   See also ZEROS , ONES
  28 

  29 
%   Copyright 1984-2014 The MathWorks, Inc.
  30 

  31 
   %------- function call with no-input -------
< 0.001 
     16 
  32
   if nargin == 0 
< 0.001 
      5 
  33
       array = matlab.graphics.GraphicsPlaceholder(); 
< 0.001 
      5 
  34
       return; 
     11 
  35
   end 
  36 
   
  37 
   % -----Ensure that all inputs are numeric -----------  
  38 
   % catch gobjects('b')   gobjects([2,'b']) gobjects(2,'b')   gobjects([])      gobjects([5;5])
  39 
   %       gobjects({1,2}) gobjects({'a'})   gobjects(2,['a']) gobjects(1,[2,3])
  40 
   %       gobjects(2,{2})
  41 
   % reject if the contents in the varargin is non-numeric (eg: char,cell)
     11 
  42
   errFlag = false; 
< 0.001 
     11 
  43
   if nargin == 1 
< 0.001 
     10 
  44
       if ( ~isnumeric(varargin{1}) || isempty(varargin{1})||~isrow(varargin{1})) 
  45 
            errFlag = true ; 
< 0.001 
     10 
  46
       end 
      1 
  47
   else 
< 0.001 
      1 
  48
       for iter = 1 : nargin 
< 0.001 
      2 
  49
            if ~isnumeric(varargin{iter}) 
  50 
                errFlag = true ;
  51 
                break ;
< 0.001 
      2 
  52
            end 
  53 
            % gobjects is consistent with zeros and ones in its treatments of non-scalar inputs
< 0.001 
      2 
  54
            if ~isscalar(varargin{iter}) 
  55 
                 errFlag = true;
< 0.001 
      2 
  56
            end  
< 0.001 
      2 
  57
       end 
     11 
  58
   end 
  59 
   
  60 
   
  61 
   % For all above error, using the same error message  
     11 
  62
   if errFlag 
  63 
       error('MATLAB:graphics:gobjects:invalidinput','Inputs must be scalar numeric or a vector of array dimensions.');
     11 
  64
   end 
  65 
   
  66 
   
  67 
   
< 0.001 
     11 
  68
   dims = [varargin{:}]; 
  69 
   %---- Ensure there are no nan and inf inputs
< 0.001 
     11 
  70
   if any(isinf(dims)) || any(isnan(dims)) 
  71 
       error('MATLAB:graphics:gobjects:naninf','Inputs must be scalar numeric or a vector of array dimensions. NaN and Inf are not allowed.');
< 0.001 
     11 
  72
   end 
  73 
   
  74 
  
  75 
   %----- Replace negative inputs to zero and truncate non-integer inputs---
< 0.001 
     11 
  76
   dims(dims < 0) = 0; % catch negative numbers 
< 0.001 
     11 
  77
   tmp = floor(dims);  % catch positive non-integers 
< 0.001 
     11 
  78
   if any(tmp~=dims) 
  79 
      error('MATLAB:graphics:gobjects:noninteger','Size vector should be a row vector with integer elements.');
     11 
  80
   end 
  81 

  82 
   
  83 
     
< 0.001 
     11 
  84
   if isscalar(dims)% ----- Single input such as gobjects(0) gobjects(6) -----  
< 0.001 
     10 
  85
       if dims == 0 
< 0.001 
     10 
  86
           array = matlab.graphics.GraphicsPlaceholder().empty; 
< 0.001 
     10 
  87
           return ; 
  88 
       else 
  89 
           array(dims, dims) = matlab.graphics.GraphicsPlaceholder();
  90 

  91 
           return ; 
  92 
       end
      1 
  93
   else            % if not scalar Multiple inputs like gobjects(6,6,6) 
  0.003 
      1 
  94
           array = repmat(matlab.graphics.GraphicsPlaceholder(),dims); 
< 0.001 
      1 
  95
           return; 
  96 
   end 

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