This is a static copy of a profile report

Home

makeValidName>getMakeValidFcnHandle/makeValid (Calls: 5, Time: 0.009 s)
Generated 04-Jun-2021 04:11:16 using performance time.
nested function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\lang\+matlab\+lang\makeValidName.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...n)makeValid(n,@replaceWithUnderscore)anonymous function5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
154
name = erase(name, whitespace)...
50.003 s34.6%
153
name = regexprep(name, '(?<...
50.002 s22.4%
158
name = invalidReplacementFun(n...
50.001 s14.1%
162
if iskeyword(name(keywordIdx))
70.001 s7.6%
172
isTooLong = (strlength(name) &...
50.000 s4.2%
All other lines  0.002 s17.2%
Totals  0.009 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
erasefunction50.003 s29.5%
...eValidFcnHandle/replaceWithUnderscorenested function50.000 s4.8%
iskeywordfunction70.000 s4.4%
makeValidName>@(token_1)upper(token_1)anonymous function110.000 s2.3%
Self time (built-ins, overhead, etc.)  0.005 s59.1%
Totals  0.009 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function31
Non-code lines (comments, blank lines)11
Code lines (lines that can run)20
Code lines that did run15
Code lines that did not run5
Coverage (did run/can run)75.00 %
Function listing
time 
Calls 
 line
 148 
    function name = makeValid(name, invalidReplacementFun)
 149 
        % Remove leading and trailing whitespace and
 150 
        % replace embedded whitespace with camel/mixed casing.
< 0.001 
      5 
 151
        whitespace = compose([" ", "\f", "\n", "\r", "\t", "\v"]); 
< 0.001 
      5 
 152
        if any(contains(name, whitespace)) 
  0.002 
      5 
 153
            name = regexprep(name, '(?<=\S)\s+([a-z])', '${upper($1)}'); 
  0.003 
      5 
 154
            name = erase(name, whitespace); 
< 0.001 
      5 
 155
        end 
 156 
        
 157 
        % Replace invalid characters as specified by ReplacementStyle.
  0.001 
      5 
 158
        name = invalidReplacementFun(name); 
 159 
        
 160 
        % Prepend keyword with PREFIX and camel case.
< 0.001 
      5 
 161
        for keywordIdx = 1:numel(name) 
< 0.001 
      7 
 162
            if iskeyword(name(keywordIdx)) 
 163 
                name{keywordIdx} = [prefix, upper(name{keywordIdx}(1)), ...
 164 
                                            lower(name{keywordIdx}(2:end))];
< 0.001 
      7 
 165
            end 
< 0.001 
      7 
 166
        end 
 167 
        
 168 
        % Insert PREFIX if the first column is non-letter.
< 0.001 
      5 
 169
        name = regexprep(name,'^(?![a-z])', prefix, 'emptymatch', 'ignorecase'); 
 170 
        
 171 
        % Truncate NAME to NAMLENGTHMAX.
< 0.001 
      5 
 172
        isTooLong = (strlength(name) > namelengthmax); 
< 0.001 
      5 
 173
        if any(isTooLong) 
 174 
            for isTooLongIdx = reshape(find(isTooLong), 1, [])
 175 
                name{isTooLongIdx} = name{isTooLongIdx}(1:namelengthmax);
 176 
            end
< 0.001 
      5 
 177
        end 
< 0.001 
      5 
 178
    end 

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