This is a static copy of a profile report

Home

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

Parents (calling functions)

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

Line NumberCodeCallsTotal Time% TimeTime Plot
653
newLabels = matlab.lang.makeUn...
20.005 s29.9%
675
obj.checkDuplicateLabels(newLa...
140.004 s22.2%
665
[newLabels,wasMadeValid] = obj...
140.002 s12.1%
685
obj = obj.assignLabels(newLabe...
140.002 s10.0%
641
elseif isText(newLabels,true) ...
140.002 s9.3%
All other lines  0.003 s16.5%
Totals  0.017 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
makeUniqueStringsfunction20.005 s28.9%
...tabularDimension.checkDuplicateLabelsclass method140.003 s17.2%
varNamesDim>varNamesDim.makeValidNameclass method140.002 s9.1%
...sion>tabularDimension.assignLabelsclass method140.001 s7.0%
isTextfunction140.001 s5.5%
varNamesDim>fillEmptyNamesclass method20.000 s1.6%
Self time (built-ins, overhead, etc.)  0.005 s30.7%
Totals  0.017 s100% 
Code Analyzer results
Line numberMessage
Coverage results
Show coverage for parent directory
Total lines in function62
Non-code lines (comments, blank lines)20
Code lines (lines that can run)42
Code lines that did run23
Code lines that did not run19
Coverage (did run/can run)54.76 %
Function listing
time 
Calls 
 line
 634 
        function obj = 	validateAndAssignLabels(obj,newLabels,varIndices,fullAssignment,fixDups,fixEmpties,fixIllegal)
 635 
            import matlab.internal.datatypes.isScalarText
 636 
            import matlab.internal.datatypes.isText
 637 
            
< 0.001 
     14 
 638
            if ~fullAssignment && isScalarText(newLabels) && (fixEmpties || (newLabels ~= "")) 
 639 
                % Accept one character vector for (partial) assignment to one name, allow empty character vectors per caller.
 640 
                newLabels = {newLabels};
  0.002 
     14 
 641
            elseif isText(newLabels,true) && (fixEmpties || ~matches("",newLabels)) 
 642 
                % Accept a cellstr, allow empty character vectors per caller.
< 0.001 
     14 
 643
                newLabels = newLabels(:)'; % a row vector, conveniently forces any empty to 0x1 
 644 
            else
 645 
                error(message('MATLAB:table:InvalidVarNames'));
< 0.001 
     14 
 646
            end 
 647 
            
< 0.001 
     14 
 648
            if fixEmpties 
 649 
                % Fill in empty names if allowed, and make them unique with respect
 650 
                % to the other new names. If not allowed, an error was already thrown.
 651 
                % This is here to fill in missing variable names when reading from a file.
< 0.001 
      2 
 652
                [newLabels,wasEmpty] = fillEmptyNames(newLabels,varIndices); 
  0.005 
      2 
 653
                newLabels = matlab.lang.makeUniqueStrings(newLabels,wasEmpty,namelengthmax); 
< 0.001 
     14 
 654
            end 
 655 
            
< 0.001 
     14 
 656
            switch convertStringsToChars(fixIllegal) 
< 0.001 
     14 
 657
                case {true, 'fixIllegal'} 
 658 
                    exceptionMode = 'warnSavedLegacy';
< 0.001 
     14 
 659
                case {false, 'errorIllegal'} 
< 0.001 
     14 
 660
                    exceptionMode = 'error'; 
 661 
                case {'fixTooLong'}
 662 
                    exceptionMode = 'warnSaved';
< 0.001 
     14 
 663
            end 
< 0.001 
     14 
 664
            originalLabels = newLabels; 
  0.002 
     14 
 665
            [newLabels,wasMadeValid] = obj.makeValidName(newLabels,exceptionMode); 
 666 
            
< 0.001 
     14 
 667
            if fixDups 
 668 
                % Make the new names (in their possibly modified form) unique with respect to
 669 
                % each other and to existing names.
 670 
                allNewLabels = obj.labels; allNewLabels(varIndices) = newLabels;
 671 
                allNewLabels = matlab.lang.makeUniqueStrings(allNewLabels,varIndices,namelengthmax);
 672 
                newLabels = allNewLabels(varIndices);
< 0.001 
     14 
 673
            elseif fullAssignment 
 674 
                % Check that the whole set of new names is unique
  0.004 
     14 
 675
                obj.checkDuplicateLabels(newLabels); 
 676 
            else
 677 
                % Make sure invalid names that have been fixed do not duplicate any of the other new
 678 
                % names.
 679 
                newLabels = matlab.lang.makeUniqueStrings(newLabels,wasMadeValid,namelengthmax);
 680 
                % Check that the new names do not duplicate each other or existing names.
 681 
                allNewLabels = obj.labels; allNewLabels(varIndices) = newLabels;
 682 
                obj.checkDuplicateLabels(newLabels,allNewLabels,varIndices);
< 0.001 
     14 
 683
            end 
 684 
            
  0.002 
     14 
 685
            obj = obj.assignLabels(newLabels,fullAssignment,varIndices); 
 686 
            
< 0.001 
     14 
 687
            if startsWith(exceptionMode,'warnSaved') && any(wasMadeValid) 
 688 
                if ~obj.hasDescrs
 689 
                    obj.descrs = repmat({''},1,obj.length);
 690 
                    obj.hasDescrs = true;
 691 
                end
 692 
                str = getString(message('MATLAB:table:uistrings:ModifiedVarNameDescr'));
 693 
                obj.descrs(varIndices(wasMadeValid)) = append(str, ' ''', originalLabels(wasMadeValid), '''');
< 0.001 
     14 
 694
            end 
< 0.001 
     14 
 695
        end 

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