This is a static copy of a profile report

Home

rowNamesDim>rowNamesDim.validateAndAssignLabels (Calls: 16, Time: 0.014 s)
Generated 16-Jul-2020 17:09:50 using performance time.
class method in file /Applications/MATLAB_R2020a.app/toolbox/matlab/datatypes/tabular/+matlab/+internal/+tabular/+private/rowNamesDim.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...mension>tabularDimension.setLabelsclass method16
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
127
newLabels = obj.makeValidName(...
80.004 s27.9%
142
obj.checkDuplicateLabels(newLa...
80.004 s26.7%
149
obj = obj.assignLabels(newLabe...
80.002 s15.7%
104
if fullAssignment && i...
160.001 s5.7%
103
elseif isCharStrings(newLabels...
160.001 s4.2%
All other lines  0.003 s19.9%
Totals  0.014 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
rowNamesDim>rowNamesDim.makeValidNameclass method80.003 s23.2%
...tabularDimension.checkDuplicateLabelsclass method80.003 s21.9%
...sion>tabularDimension.assignLabelsclass method80.001 s10.6%
Self time (built-ins, overhead, etc.)  0.006 s44.3%
Totals  0.014 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function59
Non-code lines (comments, blank lines)16
Code lines (lines that can run)43
Code lines that did run23
Code lines that did not run20
Coverage (did run/can run)53.49 %
Function listing
time 
Calls 
 line
  95 
        function obj = validateAndAssignLabels(obj,newLabels,rowIndices,fullAssignment,fixDups,fixEmpties,fixIllegal)
  96 
            import matlab.internal.datatypes.isCharString
  97 
            import matlab.internal.datatypes.isCharStrings
  98 
            import matlab.internal.tabular.private.rowNamesDim.checkReservedNames;
< 0.001 
     16 
  99
            try 
< 0.001 
     16 
 100
                if ~fullAssignment && isCharString(newLabels,fixEmpties) 
 101 
                    % Accept one character vector for (partial) assignment to one name, allow empty character vectors per caller.
 102 
                    newLabels = { strtrim(newLabels) };
< 0.001 
     16 
 103
                elseif isCharStrings(newLabels,true,fixEmpties) 
< 0.001 
     16 
 104
                    if fullAssignment && isequal(newLabels,{}) % Accept {} to remove row names 
< 0.001 
      8 
 105
                        obj.labels = {}; % force a 0x0, for cosmetics 
< 0.001 
      8 
 106
                        obj.hasLabels = false; 
< 0.001 
      8 
 107
                        return 
< 0.001 
      8 
 108
                    end 
 109 
                    % Accept a cellstr, allow empty character vectors per caller.
< 0.001 
      8 
 110
                    newLabels = strtrim(newLabels(:)); % a col vector, conveniently forces any empty to 0x1 
 111 
                else
 112 
                    error(message('MATLAB:table:InvalidRowNames'));
< 0.001 
      8 
 113
                end 
 114 
                
< 0.001 
      8 
 115
                if fixEmpties 
 116 
                    % Fill in empty names if allowed, and make them unique with respect
 117 
                    % to the other new names. If not allowed, an error was already thrown.
 118 
                    [newLabels,wasEmpty] = fillEmptyNames(newLabels,rowIndices);
 119 
                    newLabels = matlab.lang.makeUniqueStrings(newLabels,wasEmpty,namelengthmax);
< 0.001 
      8 
 120
                end 
 121 
                
< 0.001 
      8 
 122
                if ~fixIllegal 
< 0.001 
      8 
 123
                    exceptionMode = 'error'; 
 124 
                else
 125 
                    exceptionMode = 'silent';
< 0.001 
      8 
 126
                end 
  0.004 
      8 
 127
                newLabels = obj.makeValidName(newLabels,exceptionMode); 
 128 

 129 
                
< 0.001 
      8 
 130
                if fixDups 
 131 
                    % Make the new names unique with respect to each other and to existing names (if any).
 132 
                    newAndOldLabels = obj.labels;
 133 
                    if isempty(newAndOldLabels)
 134 
                        newLabels = matlab.lang.makeUniqueStrings(newLabels,1:length(newLabels),inf);
 135 
                    else
 136 
                        newAndOldLabels(rowIndices) = newLabels;
 137 
                        newAndOldLabels = matlab.lang.makeUniqueStrings(newAndOldLabels,rowIndices,inf);
 138 
                        newLabels = newAndOldLabels(rowIndices);
 139 
                    end
< 0.001 
      8 
 140
                elseif fullAssignment 
 141 
                    % Check that the whole set of new names is unique
  0.004 
      8 
 142
                    obj.checkDuplicateLabels(newLabels); 
 143 
                else
 144 
                    % Check that the new names do not duplicate each other or existing names.
 145 
                    newAndOldLabels = obj.labels; newAndOldLabels(rowIndices) = newLabels;
 146 
                    obj.checkDuplicateLabels(newLabels,newAndOldLabels,rowIndices);
< 0.001 
      8 
 147
                end 
 148 
                
  0.002 
      8 
 149
                obj = obj.assignLabels(newLabels,fullAssignment,rowIndices); 
 150 
            catch ME
 151 
                throwAsCaller(ME);
< 0.001 
      8 
 152
            end 
< 0.001 
      8 
 153
        end 

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