This is a static copy of a profile report

Home

metaDim>metaDim.validateAndAssignLabels (Calls: 3, Time: 0.004 s)
Generated 04-Jun-2021 04:11:16 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\tabular\+matlab\+internal\+tabular\+private\metaDim.m
Copy to new window for comparing multiple runs

Parents (calling functions)

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

Line NumberCodeCallsTotal Time% TimeTime Plot
157
newLabels = obj.fixLabelsForCo...
30.001 s32.8%
171
obj.checkDuplicateLabels(newLa...
30.001 s26.1%
178
obj = obj.assignLabels(newLabe...
30.001 s19.5%
139
elseif isCharStrings(newLabels...
30.000 s5.6%
141
newLabels = newLabels(:)'; % a...
30.000 s4.8%
All other lines  0.000 s11.2%
Totals  0.004 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...>metaDim.fixLabelsForCompatibilityclass method30.001 s26.6%
...tabularDimension.checkDuplicateLabelsclass method30.001 s19.7%
...sion>tabularDimension.assignLabelsclass method30.001 s12.2%
Self time (built-ins, overhead, etc.)  0.002 s41.4%
Totals  0.004 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function48
Non-code lines (comments, blank lines)16
Code lines (lines that can run)32
Code lines that did run18
Code lines that did not run14
Coverage (did run/can run)56.25 %
Function listing
time 
Calls 
 line
 132 
        function obj = validateAndAssignLabels(obj,newLabels,dimIndices,fullAssignment,fixDups,fixEmpties,fixIllegal)
 133 
            import matlab.internal.datatypes.isCharString
 134 
            import matlab.internal.datatypes.isCharStrings
 135 
            
< 0.001 
      3 
 136
            if ~fullAssignment && isCharString(newLabels) && (fixEmpties || (newLabels ~= "")) 
 137 
                % Accept one character vector for (partial) assignment to one name, allow empty character vectors per caller.
 138 
                newLabels = { newLabels };
< 0.001 
      3 
 139
            elseif isCharStrings(newLabels,true) && (fixEmpties || ~any((newLabels == ""),'all')) 
 140 
                % Accept a cellstr, allow empty character vectors per caller.
< 0.001 
      3 
 141
                newLabels = newLabels(:)'; % a row vector, conveniently forces any empty to 0x1 
 142 
            else
 143 
                error(message('MATLAB:table:InvalidDimNames'));
< 0.001 
      3 
 144
            end 
 145 

< 0.001 
      3 
 146
            if fixEmpties 
 147 
                % Fill in empty names if allowed, and make them unique with respect
 148 
                % to the other new names. If not allowed, an error was already thrown.
 149 
                [newLabels,wasEmpty] = fillEmptyNames(newLabels,dimIndices);
 150 
                newLabels = matlab.lang.makeUniqueStrings(newLabels,wasEmpty,namelengthmax);
      3 
 151
            end 
 152 
            
< 0.001 
      3 
 153
            if fixIllegal 
 154 
                newLabels = obj.makeValidName(newLabels,'warn');
< 0.001 
      3 
 155
            else 
< 0.001 
      3 
 156
                if obj.backwardsCompatibility % tables, for now 
  0.001 
      3 
 157
                    newLabels = obj.fixLabelsForCompatibility(newLabels); 
 158 
                else % timetables
 159 
                    newLabels = obj.makeValidName(newLabels,'error');
< 0.001 
      3 
 160
                end 
< 0.001 
      3 
 161
            end 
 162 
            
< 0.001 
      3 
 163
            if fixDups 
 164 
                % Make the new names (in their possibly modified form) unique with respect to
 165 
                % each other and to existing names.
 166 
                allNewLabels = obj.labels; allNewLabels(dimIndices) = newLabels;
 167 
                allNewLabels = matlab.lang.makeUniqueStrings(allNewLabels,dimIndices,namelengthmax);
 168 
                newLabels = allNewLabels(dimIndices);
< 0.001 
      3 
 169
            elseif fullAssignment 
 170 
                % Check that the whole set of new names is unique
  0.001 
      3 
 171
                obj.checkDuplicateLabels(newLabels); 
 172 
            else
 173 
                % Check that the new names do not duplicate each other or existing names.
 174 
                allNewLabels = obj.labels; allNewLabels(dimIndices) = newLabels;
 175 
                obj.checkDuplicateLabels(newLabels,allNewLabels,dimIndices);
< 0.001 
      3 
 176
            end 
 177 
            
< 0.001 
      3 
 178
            obj = obj.assignLabels(newLabels,fullAssignment,dimIndices); 
< 0.001 
      3 
 179
        end 

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