This is a static copy of a profile report

Home

gobjects (Calls: 220, Time: 0.021 s)
Generated 16-Jul-2020 17:08:40 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/graphics/objectsystem/gobjects.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
newplotfunction120
objArrayDispatchfunction94
getRulersForChildfunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
86
array = matlab.graphics.Graphi...
1260.010 s47.6%
33
array = matlab.graphics.Graphi...
940.005 s23.7%
76
dims(dims < 0) = 0; % catch...
1260.001 s5.0%
44
if ( ~isnumeric(varargin{1}) |...
1260.001 s4.5%
87
return ;
1260.001 s3.2%
All other lines  0.003 s15.9%
Totals  0.021 s100% 
Children (called functions)
No children
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 run22
Code lines that did not run22
Coverage (did run/can run)50.00 %
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 
    220 
  32
   if nargin == 0 
  0.005 
     94 
  33
       array = matlab.graphics.GraphicsPlaceholder(); 
< 0.001 
     94 
  34
       return; 
< 0.001 
    126 
  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)
< 0.001 
    126 
  42
   errFlag = false; 
< 0.001 
    126 
  43
   if nargin == 1 
< 0.001 
    126 
  44
       if ( ~isnumeric(varargin{1}) || isempty(varargin{1})||~isrow(varargin{1})) 
  45 
            errFlag = true ; 
< 0.001 
    126 
  46
       end 
  47 
   else
  48 
       for iter = 1 : nargin
  49 
            if ~isnumeric(varargin{iter})
  50 
                errFlag = true ;
  51 
                break ;
  52 
            end
  53 
            % gobjects is consistent with zeros and ones in its treatments of non-scalar inputs
  54 
            if ~isscalar(varargin{iter})
  55 
                 errFlag = true;
  56 
            end 
  57 
       end
< 0.001 
    126 
  58
   end 
  59 
   
  60 
   
  61 
   % For all above error, using the same error message  
< 0.001 
    126 
  62
   if errFlag 
  63 
       error('MATLAB:graphics:gobjects:invalidinput','Inputs must be scalar numeric or a vector of array dimensions.');
< 0.001 
    126 
  64
   end 
  65 
   
  66 
   
  67 
   
< 0.001 
    126 
  68
   dims = [varargin{:}]; 
  69 
   %---- Ensure there are no nan and inf inputs
< 0.001 
    126 
  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 
    126 
  72
   end 
  73 
   
  74 
  
  75 
   %----- Replace negative inputs to zero and truncate non-integer inputs---
  0.001 
    126 
  76
   dims(dims < 0) = 0; % catch negative numbers 
< 0.001 
    126 
  77
   tmp = floor(dims);  % catch positive non-integers 
< 0.001 
    126 
  78
   if any(tmp~=dims) 
  79 
      error('MATLAB:graphics:gobjects:noninteger','Size vector should be a row vector with integer elements.');
< 0.001 
    126 
  80
   end 
  81 

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

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

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