This is a static copy of a profile report

Home

join (Calls: 3, Time: 0.002 s)
Generated 18-May-2021 16:05:14 using performance time.
function in file /usr/local/MATLAB/R2021a/toolbox/matlab/strfun/join.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...stener.workspaceUpdatedCorrectContextclass method3
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
58
if ~isTextStrict(str)
30.001 s39.2%
71
end
30.000 s6.7%
64
s = string(str);
30.000 s6.1%
65
s = s.join(varargin{:});
30.000 s5.5%
69
elseif ~isstring(str)
30.000 s4.8%
All other lines  0.001 s37.8%
Totals  0.002 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
strfun/private/isTextStrictfunction30.000 s16.8%
Self time (built-ins, overhead, etc.)  0.002 s83.2%
Totals  0.002 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function75
Non-code lines (comments, blank lines)58
Code lines (lines that can run)17
Code lines that did run12
Code lines that did not run5
Coverage (did run/can run)70.59 %
Function listing
time 
Calls 
 line
   1 
function s = join(str, varargin)
   2 
% JOIN Append elements of a string array together
   3 
%    NEWSTR = JOIN(STR) appends the elements of STR, placing a space
   4 
%    character between consecutive strings, and returns the result as the
   5 
%    output array NEWSTR. JOIN combines strings along the last dimension of
   6 
%    STR not equal to 1. STR can be a string array, a character vector, or
   7 
%    a cell array of character vectors. NEWSTR has the same data type as
   8 
%    STR. If STR is a character vector, then STR and NEWSTR are identical.
   9 
%
  10 
%    NEWSTR = JOIN(STR,DELIMITER) appends the elements of STR and places
  11 
%    elements of DELIMITER between them. If STR and DELIMITER are string
  12 
%    arrays or cell arrays, then DELIMITER must have one element less than
  13 
%    STR along the dimension being joined. The size of every other
  14 
%    dimension of DELIMITER either must be 1 or must match the size of the
  15 
%    corresponding dimension of STR. The space character is the default
  16 
%    value of DELIMITER.
  17 
% 
  18 
%    NEWSTR = JOIN(STR,DIM) appends the elements of STR along the dimension
  19 
%    DIM. The default value of DIM is the last dimension of STR with a size
  20 
%    that does not equal 1.
  21 
% 
  22 
%    NEWSTR = JOIN(STR,DELIMITER,DIM) appends the elements of STR along
  23 
%    the dimension DIM and places elements of DELIMITER between the
  24 
%    strings.
  25 
%
  26 
%    Example:
  27 
%        STR = ["John","Smith";"Mary","Jones"];
  28 
%        join(STR)
  29 
%    
  30 
%    returns
  31 
%
  32 
%        "John Smith"
  33 
%        "Mary Jones"
  34 
%
  35 
%    Example:
  36 
%        STR = {'John','Smith';'Mary','Jones'};
  37 
%        join(STR,1)
  38 
%
  39 
%    returns
  40 
%
  41 
%        'John Mary'    'Smith Jones'
  42 
%
  43 
%    Example:
  44 
%        STR = ["x","y","z";"a","b","c"];
  45 
%        DELIMITER = {' + ',' = ';' - ',' = '};
  46 
%        join(STR,DELIMITER)
  47 
%
  48 
%    returns
  49 
%
  50 
%        "x + y = z"
  51 
%        "a - b = c"    
  52 
%
  53 
%    See also SPLIT, STRING/PLUS, COMPOSE
  54 

  55 
%   Copyright 2015-2017 The MathWorks, Inc.
  56 

      3 
  57
    narginchk(1, 3); 
< 0.001 
      3 
  58
    if ~isTextStrict(str) 
  59 
        firstInput = getString(message('MATLAB:string:FirstInput'));
  60 
        error(message('MATLAB:string:MustBeCharCellArrayOrString', firstInput));
      3 
  61
    end 
  62 
    
< 0.001 
      3 
  63
    try 
< 0.001 
      3 
  64
        s = string(str); 
< 0.001 
      3 
  65
        s = s.join(varargin{:}); 
  66 

      3 
  67
        if ischar(str) 
  68 
            s = str;
< 0.001 
      3 
  69
        elseif ~isstring(str) 
< 0.001 
      3 
  70
            s = cellstr(s); 
< 0.001 
      3 
  71
        end 
  72 
    catch E
  73 
        throw(E);
      3 
  74
    end 
< 0.001 
      3 
  75
end 

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