This is a static copy of a profile report

Home

categorical.subsref (Calls: 618310, Time: 7.295 s)
Generated 04-Jun-2021 04:11:12 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\categorical\@categorical\subsref.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
tabular.subsrefDotfunction618310
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
that = this.parenReference(s.s...
6183106.384 s87.5%
28
case '()'
6183100.093 s1.3%
27
switch s.type
6183100.079 s1.1%
40
end
6183100.071 s1.0%
16
if ~isscalar(s)
6183100.033 s0.5%
All other lines  0.635 s8.7%
Totals  7.295 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
categorical.parenReferencefunction6183105.035 s69.0%
Self time (built-ins, overhead, etc.)  2.260 s31.0%
Totals  7.295 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function40
Non-code lines (comments, blank lines)20
Code lines (lines that can run)20
Code lines that did run6
Code lines that did not run14
Coverage (did run/can run)30.00 %
Function listing
time 
Calls 
 line
   1 
function that = subsref(this,s)
   2 
%SUBSREF Subscripted reference for a categorical array.
   3 
%     B = SUBSREF(A,S) is called for the syntax A(I).  S is a structure array
   4 
%     with the fields:
   5 
%         type -- Character vector containing '()' specifying the subscript type.
   6 
%                 Only parenthesis subscripting is allowed.
   7 
%         subs -- Cell array containing the actual subscripts.
   8 
%
   9 
%   See also CATEGORICAL/CATEGORICAL, SUBSASGN.
  10 

  11 
%   Copyright 2006-2016 The MathWorks, Inc.
  12 

  13 
import matlab.internal.datatypes.tryThrowIllegalDotMethodError
  14 

  15 
% Make sure nothing follows the () subscript.
  0.033 
 618310 
  16
if ~isscalar(s) 
  17 
    isDotParenReference = isequal({s.type},{'.','()'});
  18 
    if isDotParenReference
  19 
        name = s.subs;
  20 
        tryThrowIllegalDotMethodError(this,name,'MethodsWithNoCorrection',"cat");
  21 
        error(message('MATLAB:categorical:FieldReferenceNotAllowed'));
  22 
    else
  23 
        error(message('MATLAB:categorical:InvalidSubscripting'));
  24 
    end
  0.028 
 618310 
  25
end 
  26 

  0.079 
 618310 
  27
switch s.type 
  0.093 
 618310 
  28
case '()' 
  29 
    % Normally, only multi-level paren references like c(i).Property get here,
  30 
    % and for categorical those are an error and caught above. Simple paren
  31 
    % references should normally go to parenReference. But someone (including
  32 
    % tabular) might call this method explicitly, so handle the latter.
  6.384 
 618310 
  33
    that = this.parenReference(s.subs{:}); 
  34 
case '{}'
  35 
    error(message('MATLAB:categorical:CellReferenceNotAllowed'))
  36 
case '.'
  37 
    name = s.subs;
  38 
    tryThrowIllegalDotMethodError(this,name,'MethodsWithNoCorrection',"cat");
  39 
    error(message('MATLAB:categorical:FieldReferenceNotAllowed'));
  0.071 
 618310 
  40
end