This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
cell.strcatfunction104
datevecfunction10
datenumfunction10
legend>process_inputssubfunction8
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
31
c = deblank(c);
1240.000 s16.3%
27
c = cell(numrows,1);
1240.000 s12.4%
29
c{i} = s(i,:);
1240.000 s9.0%
28
for i = 1:numrows
1240.000 s8.6%
33
elseif iscellstr(s)
80.000 s8.5%
All other lines  0.001 s45.2%
Totals  0.003 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
33To support string in addition to cellstr, include a call to 'isstring'.
Coverage results
Show coverage for parent directory
Total lines in function50
Non-code lines (comments, blank lines)19
Code lines (lines that can run)31
Code lines that did run14
Code lines that did not run17
Coverage (did run/can run)45.16 %
Function listing
time 
Calls 
 line
   1 
function c = cellstr(s)
   2 
%CELLSTR Create cell array of character vectors
   3 
%   C = CELLSTR(S) converts S to a cell array of character vectors.
   4 
%   If S is a string array, then CELLSTR converts each element of S.
   5 
%   If S is a character array, then CELLSTR places each row into a
   6 
%   separate cell of C. Any trailing spaces in the character vectors are 
   7 
%   removed.
   8 
%
   9 
%   Use STRING to convert C to a string array, or CHAR to convert C
  10 
%   to a character array.
  11 
%
  12 
%   Another way to create a cell array of character vectors is by using 
  13 
%   curly braces:
  14 
%      C = {'hello' 'yes' 'no' 'goodbye'};
  15 
%
  16 
%   See also STRING, CHAR, ISCELLSTR.
  17 

  18 
%   Copyright 1984-2016 The MathWorks, Inc.
  19 

< 0.001 
    132 
  20
if ischar(s) 
< 0.001 
    124 
  21
    if isempty(s) 
  22 
        c = {''};
< 0.001 
    124 
  23
    elseif ~ismatrix(s) 
  24 
        error(message('MATLAB:cellstr:InputShape'))
< 0.001 
    124 
  25
    else 
< 0.001 
    124 
  26
        numrows = size(s,1); 
< 0.001 
    124 
  27
        c = cell(numrows,1); 
< 0.001 
    124 
  28
        for i = 1:numrows 
< 0.001 
    124 
  29
            c{i} = s(i,:); 
< 0.001 
    124 
  30
        end 
< 0.001 
    124 
  31
        c = deblank(c); 
< 0.001 
    124 
  32
    end 
< 0.001 
      8 
  33
elseif iscellstr(s) 
< 0.001 
      8 
  34
    c = s; 
  35 
elseif iscell(s)
  36 
    c = cell(size(s));
  37 
    for i=1:numel(s)
  38 
        if ischar(s{i}) || (isstring(s{i}) && isscalar(s{i}) && ~ismissing(s{i}))
  39 
            c{i} = char(s{i});
  40 
        else
  41 
            if (isstring(s{i}) && isscalar(s{i})) && ismissing(s{i})
  42 
                error(message('MATLAB:string:CannotConvertMissingElementToChar', i));
  43 
            else
  44 
                error(message('MATLAB:cellstr:MustContainText', i));
  45 
            end
  46 
        end
  47 
    end
  48 
else
  49 
    error(message('MATLAB:invalidConversion', 'cellstr', class(s)));
< 0.001 
    132 
  50
end 

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