This is a static copy of a profile report

Home

Function details for gobjectsThis is a static copy of a profile report

Home

gobjects (Calls: 4, Time: 0.005 s)
Generated 01-May-2020 20:23:08 using performance time.
function in file /Applications/MATLAB_R2018a.app/toolbox/matlab/graphics/gobjects.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
newplotfunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
68
dims = [varargin{:}];
40.002 s34.0%
44
if ( ~isnumeric(varargin{1}) |...
40.001 s18.9%
86
array = matlab.graphics.Graphi...
40.001 s16.6%
76
dims(dims < 0) = 0; % catch...
40.001 s10.7%
85
if dims == 0
40.000 s4.6%
All other lines  0.001 s15.2%
Totals  0.005 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 run15
Code lines that did not run29
Coverage (did run/can run)34.09 %
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 
      4 
  32
   if nargin == 0 
  33 
       array = matlab.graphics.GraphicsPlaceholder();
  34 
       return;
  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 
      4 
  42
   errFlag = false; 
< 0.001 
      4 
  43
   if nargin == 1 
< 0.001 
      4 
  44
       if ( ~isnumeric(varargin{1}) || isempty(varargin{1})||~isrow(varargin{1})) 
  45 
            errFlag = true ; 
  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 
      4 
  58
   end 
  59 
   
  60 
   
  61 
   % For all above error, using the same error message  
< 0.001 
      4 
  62
   if errFlag 
  63 
       error('MATLAB:graphics:gobjects:invalidinput','Inputs must be scalar numeric or a vector of array dimensions.');
  64 
   end
  65 
   
  66 
   
  67 
   
  0.002 
      4 
  68
   dims = [varargin{:}]; 
  69 
   %---- Ensure there are no nan and inf inputs
< 0.001 
      4 
  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.');
  72 
   end
  73 
   
  74 
  
  75 
   %----- Replace negative inputs to zero and truncate non-integer inputs---
< 0.001 
      4 
  76
   dims(dims < 0) = 0; % catch negative numbers 
< 0.001 
      4 
  77
   tmp = floor(dims);  % catch positive non-integers 
< 0.001 
      4 
  78
   if any(tmp~=dims) 
  79 
      error('MATLAB:graphics:gobjects:noninteger','Size vector should be a row vector with integer elements.');
  80 
   end
  81 

  82 
   
  83 
     
< 0.001 
      4 
  84
   if isscalar(dims)% ----- Single input such as gobjects(0) gobjects(6) -----  
< 0.001 
      4 
  85
       if dims == 0 
< 0.001 
      4 
  86
           array = matlab.graphics.GraphicsPlaceholder().empty; 
< 0.001 
      4 
  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.