This is a static copy of a profile report

Home

generateArgumentDescriptor (Calls: 2, Time: 0.002 s)
Generated 04-Jun-2021 04:11:07 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\lang\+matlab\+internal\+validators\generateArgumentDescriptor.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
attributes>checkInputssubfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
28
if ~isCharOrString( inputs{1} ...
20.000 s14.9%
74
if isempty( argpos )
20.000 s10.0%
75
if isempty( argname )
20.000 s6.7%
57
( isscalar(inputs{3}) || isemp...
20.000 s6.5%
35
if ~isstring( inputs{1} ) || ~...
20.000 s6.3%
All other lines  0.001 s55.7%
Totals  0.002 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...eArgumentDescriptor>isCharOrStringsubfunction60.000 s7.8%
Self time (built-ins, overhead, etc.)  0.002 s92.2%
Totals  0.002 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function88
Non-code lines (comments, blank lines)19
Code lines (lines that can run)69
Code lines that did run37
Code lines that did not run32
Coverage (did run/can run)53.62 %
Function listing
time 
Calls 
 line
   1 
function [ fname, msgId, argname, argpos ]  = generateArgumentDescriptor( inputs, callingFunc )
< 0.001 
      2 
   2
; %#ok<NOSEM> % Undocumented 
   3 

   4 
% Copyright 2011-6 The MathWorks, Inc.
   5 

   6 
% initialize optional inputs to default values
< 0.001 
      2 
   7
fname = ''; 
< 0.001 
      2 
   8
argname = ''; 
< 0.001 
      2 
   9
argpos = []; 
  10 

< 0.001 
      2 
  11
if numel( inputs ) > 0 
  12 
    % Try to disambiguate between user specifying argument position or
  13 
    % function name as the fourth input
< 0.001 
      2 
  14
    if numel( inputs ) == 1 
  15 
        if isa( inputs{1}, 'double' )
  16 
            if ~isscalar( inputs{1} ) 
  17 
                error( matlab.internal.validators.generateId( callingFunc, 'badFunctionName' ), ...
  18 
                    '%s', createMessageString(callingFunc, 'badFunctionName') )                
  19 
            elseif ~isfinite(inputs{1}) || ~(floor(inputs{1})==inputs{1}) || inputs{1} < 1
  20 
                error( matlab.internal.validators.generateId( callingFunc, 'badArgPosition' ), ...
  21 
                    '%s', createMessageString(callingFunc, 'badArgPosition') ) 
  22 
            end
  23 
        elseif ~isCharOrString( inputs{1} )
  24 
            error( matlab.internal.validators.generateId( callingFunc, 'badFunctionName' ), ...
  25 
                '%s', createMessageString(callingFunc, 'badFunctionName') )
  26 
        end
< 0.001 
      2 
  27
    else 
< 0.001 
      2 
  28
        if ~isCharOrString( inputs{1} ) 
  29 
            error( matlab.internal.validators.generateId( callingFunc, 'badFunctionNameString' ), ...
  30 
                '%s', createMessageString(callingFunc, 'badFunctionNameString') );
< 0.001 
      2 
  31
        end 
< 0.001 
      2 
  32
    end 
  33 
    
< 0.001 
      2 
  34
    if isCharOrString( inputs{1} ) 
< 0.001 
      2 
  35
        if ~isstring( inputs{1} ) || ~ismissing( inputs{1} ) 
< 0.001 
      2 
  36
            fname = char(inputs{1}); 
< 0.001 
      2 
  37
        end 
  38 
    else
  39 
        argpos = inputs{1};
      2 
  40
    end 
< 0.001 
      2 
  41
end 
  42 

< 0.001 
      2 
  43
if numel( inputs ) > 1 
< 0.001 
      2 
  44
    if ~isCharOrString( inputs{2} ) 
  45 
        error( matlab.internal.validators.generateId( callingFunc, 'badVariableName' ), ...
  46 
            '%s', createMessageString(callingFunc, 'badVariableName') )
< 0.001 
      2 
  47
    end 
  48 
    
< 0.001 
      2 
  49
    if ~isstring( inputs{2} ) || ~ismissing( inputs{2} ) 
< 0.001 
      2 
  50
        argname = char(inputs{2}); 
< 0.001 
      2 
  51
    end 
< 0.001 
      2 
  52
end 
  53 

< 0.001 
      2 
  54
if numel( inputs ) > 2 
  55 
    % cascade the checks to get specific error messages
< 0.001 
      2 
  56
    if isnumeric(inputs{3}) && ... 
      2 
  57
            ( isscalar(inputs{3}) || isempty(inputs{3}) ) 
  58 
        % any empty is ok
< 0.001 
      2 
  59
        if ~isempty(inputs{3}) && ... 
  60 
                (~isfinite(inputs{3}) || ~(floor(inputs{3})==inputs{3}) || inputs{3} < 1)
  61 
            error( matlab.internal.validators.generateId( callingFunc, 'badArgPosition' ), ...
  62 
                '%s', createMessageString(callingFunc, 'badArgPosition') )
< 0.001 
      2 
  63
        end 
  64 
    else
  65 
        error( matlab.internal.validators.generateId( callingFunc, 'badArgPositionClass' ), ...
  66 
            '%s', createMessageString(callingFunc, 'badArgPositionClass') )
< 0.001 
      2 
  67
    end 
  68 
            
< 0.001 
      2 
  69
    argpos = inputs{3}; 
< 0.001 
      2 
  70
end 
  71 

  72 
% build the argument descriptor based on which inputs were specified
  73 
% by the user
< 0.001 
      2 
  74
if isempty( argpos ) 
< 0.001 
      2 
  75
    if isempty( argname ) 
< 0.001 
      2 
  76
        msgId = 'NoNameNoNumber'; 
  77 
    else
  78 
        msgId = 'NameNoNumber';
< 0.001 
      2 
  79
    end 
  80 
else
  81 
    if isempty( argname )
  82 
        msgId = 'NoNameNumber';
  83 
    else
  84 
        msgId = 'NameNumber';
  85 
    end
< 0.001 
      2 
  86
end     
  87 

< 0.001 
      2 
  88
end 

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