This is a static copy of a profile report

Home

erase (Calls: 5, Time: 0.003 s)
Generated 04-Jun-2021 04:11:08 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\strfun\erase.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...me>getMakeValidFcnHandle/makeValidnested function5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
46
s = convertStringToOriginalTex...
50.001 s34.6%
38
if ~isTextStrict(str)
50.001 s31.3%
45
s = s.erase(match);
50.000 s10.7%
44
s = string(str);
50.000 s3.8%
51
end
50.000 s0.3%
All other lines  0.001 s19.3%
Totals  0.003 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
strfun\private\isTextStrictfunction50.000 s18.0%
str...te\convertStringToOriginalTextTypefunction50.000 s17.6%
Self time (built-ins, overhead, etc.)  0.002 s64.4%
Totals  0.003 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function51
Non-code lines (comments, blank lines)38
Code lines (lines that can run)13
Code lines that did run9
Code lines that did not run4
Coverage (did run/can run)69.23 %
Function listing
time 
Calls 
 line
   1 
function s = erase(str, match)
   2 
%ERASE Remove content from text
   3 
%   NEWSTR = ERASE(STR,PAT) removes occurrences of PAT from STR. If
   4 
%   STR contains multiple occurrences of PAT, then ERASE removes all
   5 
%   occurrences that do not overlap.
   6 
%
   7 
%   STR must be text, which means it can be a string array, a character
   8 
%   vector, or a cell array of character vectors. PAT can be text or a
   9 
%   pattern array. PAT and STR need not have the same size. 
  10 
%   If PAT is a string array, a cell array, or a pattern array, then ERASE removes each
  11 
%   occurrence of all the elements of PAT from STR.
  12 
%
  13 
%   Examples:
  14 
%       STR = "The quick brown fox";
  15 
%       PAT = " quick";
  16 
%       erase(STR,PAT)            
  17 
%
  18 
%       % returns "The brown fox"
  19 
%
  20 
%       STR = 'Hello World';
  21 
%       PAT = 'Hello ';
  22 
%       erase(STR,PAT)            
  23 
%
  24 
%       % returns 'World'
  25 
%
  26 
%       STR = "The answer is 42!";
  27 
%       PAT = whitespacePattern + digitsPattern;
  28 
%       erase(STR,PAT)            
  29 
%
  30 
%       % returns "The answer is!"
  31 
%
  32 
%   See also STRREP, REGEXPREP, REPLACE, ERASEBETWEEN, PATTERN
  33 

  34 
%   Copyright 2016-2020 The MathWorks, Inc.
  35 

< 0.001 
      5 
  36
    narginchk(2, 2); 
  37 
    
< 0.001 
      5 
  38
    if ~isTextStrict(str) 
  39 
        firstInput = getString(message('MATLAB:string:FirstInput'));
  40 
        error(message('MATLAB:string:MustBeCharCellArrayOrString', firstInput));
< 0.001 
      5 
  41
    end 
  42 

< 0.001 
      5 
  43
    try 
< 0.001 
      5 
  44
        s = string(str); 
< 0.001 
      5 
  45
        s = s.erase(match); 
< 0.001 
      5 
  46
        s = convertStringToOriginalTextType(s, str); 
  47 
        
  48 
    catch E
  49 
        throw(E)
< 0.001 
      5 
  50
    end 
< 0.001 
      5 
  51
end 

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