This is a static copy of a profile report

Home

strlength (Calls: 52, Time: 0.003 s)
Generated 16-Jul-2020 17:09:35 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/strfun/strlength.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
partialMatchStringfunction20
validateVariableNameLengthfunction16
tabular.disp>boldifyLabelssubfunction16
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
47
if ischar(element) && ...
720.001 s17.2%
52
end
720.000 s13.3%
41
if ischar(s) && (isemp...
520.000 s9.7%
46
element = s{idx};
720.000 s8.8%
44
len = zeros(size(s));
160.000 s8.7%
All other lines  0.001 s42.2%
Totals  0.003 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function56
Non-code lines (comments, blank lines)39
Code lines (lines that can run)17
Code lines that did run13
Code lines that did not run4
Coverage (did run/can run)76.47 %
Function listing
time 
Calls 
 line
   1 
function len = strlength(s)
   2 
%STRLENGTH Lengths of text elements.
   3 
%   L = STRLENGTH(STR) returns the number of characters in STR.
   4 
%
   5 
%   STR can be a string array, a character vector, or a cell array of
   6 
%   character vectors. If STR is a string array or cell array, then L is a
   7 
%   numeric array, where each element is the number of characters in the
   8 
%   corresponding element of STR.
   9 
% 
  10 
%   Example:
  11 
%       STR = "data.xlsx";
  12 
%       strlength(STR)      
  13 
%
  14 
%       returns  
  15 
%
  16 
%            9
  17 
% 
  18 
%   Example:
  19 
%       STR = 'annualReport.docx';
  20 
%       strlength(STR)      
  21 
%
  22 
%       returns  
  23 
%
  24 
%           17
  25 
% 
  26 
%   Example:
  27 
%       STR = ["funds.xlsx";"demo.ppt"];
  28 
%       strlength(STR)      
  29 
%
  30 
%       returns  
  31 
%
  32 
%           10
  33 
%            8
  34 
%
  35 
%   See also LENGTH.
  36 

  37 
%   Copyright 2014-2017 The MathWorks, Inc.
  38 

< 0.001 
     52 
  39
    narginchk(1, 1); 
  40 

< 0.001 
     52 
  41
    if ischar(s) && (isempty(s) || isrow(s)) 
< 0.001 
     36 
  42
        len = numel(s); 
< 0.001 
     16 
  43
    elseif iscell(s) 
< 0.001 
     16 
  44
        len = zeros(size(s)); 
< 0.001 
     16 
  45
        for idx = 1:numel(s) 
< 0.001 
     72 
  46
            element = s{idx}; 
< 0.001 
     72 
  47
            if ischar(element) && (isempty(element) || isrow(element)) 
< 0.001 
     72 
  48
                len(idx) = numel(element); 
  49 
            else
  50 
                error(firstInputErrorMessage);
< 0.001 
     72 
  51
            end 
< 0.001 
     72 
  52
        end 
  53 
    else
  54 
        error(firstInputErrorMessage);
< 0.001 
     52 
  55
    end 
< 0.001 
     52 
  56
end 

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