This is a static copy of a profile report

Home

varNamesDim>varNamesDim.validateAndAssignLabels (Calls: 8, Time: 0.019 s)
Generated 16-Jul-2020 17:09:51 using performance time.
class method in file /Applications/MATLAB_R2020a.app/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 method8
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
640
[newLabels,wasMadeValid] = obj...
80.008 s44.1%
650
obj.checkDuplicateLabels(newLa...
80.004 s20.4%
660
obj = obj.assignLabels(newLabe...
80.002 s12.6%
616
elseif isText(newLabels,true) ...
80.002 s11.1%
618
newLabels = newLabels(:)'; % a...
80.000 s2.4%
All other lines  0.002 s9.4%
Totals  0.019 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
varNamesDim>varNamesDim.makeValidNameclass method80.008 s39.5%
...tabularDimension.checkDuplicateLabelsclass method80.003 s15.4%
...sion>tabularDimension.assignLabelsclass method80.002 s8.3%
isTextfunction80.001 s5.5%
Self time (built-ins, overhead, etc.)  0.006 s31.1%
Totals  0.019 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 run21
Code lines that did not run21
Coverage (did run/can run)50.00 %
Function listing
time 
Calls 
 line
 609 
        function obj = 	validateAndAssignLabels(obj,newLabels,varIndices,fullAssignment,fixDups,fixEmpties,fixIllegal)
 610 
            import matlab.internal.datatypes.isScalarText
 611 
            import matlab.internal.datatypes.isText
 612 
            
< 0.001 
      8 
 613
            if ~fullAssignment && isScalarText(newLabels) && (fixEmpties || ~strcmp(newLabels,'')) 
 614 
                % Accept one character vector for (partial) assignment to one name, allow empty character vectors per caller.
 615 
                newLabels = {newLabels};
  0.002 
      8 
 616
            elseif isText(newLabels,true) && (fixEmpties || ~any(strcmp(newLabels,''),'all')) 
 617 
                % Accept a cellstr, allow empty character vectors per caller.
< 0.001 
      8 
 618
                newLabels = newLabels(:)'; % a row vector, conveniently forces any empty to 0x1 
 619 
            else
 620 
                error(message('MATLAB:table:InvalidVarNames'));
< 0.001 
      8 
 621
            end 
 622 
            
< 0.001 
      8 
 623
            if fixEmpties 
 624 
                % Fill in empty names if allowed, and make them unique with respect
 625 
                % to the other new names. If not allowed, an error was already thrown.
 626 
                % This is here to fill in missing variable names when reading from a file.
 627 
                [newLabels,wasEmpty] = fillEmptyNames(newLabels,varIndices);
 628 
                newLabels = matlab.lang.makeUniqueStrings(newLabels,wasEmpty,namelengthmax);
< 0.001 
      8 
 629
            end 
 630 
            
< 0.001 
      8 
 631
            switch convertStringsToChars(fixIllegal) 
< 0.001 
      8 
 632
                case {true, 'fixIllegal'} 
 633 
                    exceptionMode = 'warnSavedLegacy';
< 0.001 
      8 
 634
                case {false, 'errorIllegal'} 
< 0.001 
      8 
 635
                    exceptionMode = 'error'; 
 636 
                case {'fixTooLong'}
 637 
                    exceptionMode = 'warnSaved';
< 0.001 
      8 
 638
            end 
< 0.001 
      8 
 639
            originalLabels = newLabels; 
  0.008 
      8 
 640
            [newLabels,wasMadeValid] = obj.makeValidName(newLabels,exceptionMode); 
 641 
            
< 0.001 
      8 
 642
            if fixDups 
 643 
                % Make the new names (in their possibly modified form) unique with respect to
 644 
                % each other and to existing names.
 645 
                allNewLabels = obj.labels; allNewLabels(varIndices) = newLabels;
 646 
                allNewLabels = matlab.lang.makeUniqueStrings(allNewLabels,varIndices,namelengthmax);
 647 
                newLabels = allNewLabels(varIndices);
< 0.001 
      8 
 648
            elseif fullAssignment 
 649 
                % Check that the whole set of new names is unique
  0.004 
      8 
 650
                obj.checkDuplicateLabels(newLabels); 
 651 
            else
 652 
                % Make sure invalid names that have been fixed do not duplicate any of the other new
 653 
                % names.
 654 
                newLabels = matlab.lang.makeUniqueStrings(newLabels,wasMadeValid,namelengthmax);
 655 
                % Check that the new names do not duplicate each other or existing names.
 656 
                allNewLabels = obj.labels; allNewLabels(varIndices) = newLabels;
 657 
                obj.checkDuplicateLabels(newLabels,allNewLabels,varIndices);
< 0.001 
      8 
 658
            end 
 659 
            
  0.002 
      8 
 660
            obj = obj.assignLabels(newLabels,fullAssignment,varIndices); 
 661 
            
< 0.001 
      8 
 662
            if startsWith(exceptionMode,'warnSaved') && any(wasMadeValid) 
 663 
                if ~obj.hasDescrs
 664 
                    obj.descrs = repmat({''},1,obj.length);
 665 
                    obj.hasDescrs = true;
 666 
                end
 667 
                str = { getString(message('MATLAB:table:uistrings:ModifiedVarNameDescr')) };
 668 
                obj.descrs(varIndices(wasMadeValid)) = strcat(str, {' '''}, originalLabels(wasMadeValid), {''''});
< 0.001 
      8 
 669
            end 
< 0.001 
      8 
 670
        end 

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