This is a static copy of a profile report

Home

isText (Calls: 8, Time: 0.001 s)
Generated 16-Jul-2020 17:09:52 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/isText.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...t;varNamesDim.validateAndAssignLabelsclass method8
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
63
tf = isCharStrings(txt, vararg...
80.000 s30.9%
62
if nargout < 2
80.000 s13.0%
67
end
80.000 s0.7%
36
narginchk(1,3)
80.000 s0.4%
38
if isstring(txt)
80.000 s0.1%
All other lines  0.001 s54.8%
Totals  0.001 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function67
Non-code lines (comments, blank lines)39
Code lines (lines that can run)28
Code lines that did run7
Code lines that did not run21
Coverage (did run/can run)25.00 %
Function listing
time 
Calls 
 line
   1 
function [tf,txt] = isText(txt, varargin)
   2 
%ISTEXT True for an array containing text values
   3 
%   TF = ISTEXT(TXT) returns true if TXT is an array containing text, i.e. TXT is
   4 
%      * a string array
   5 
%      * a 1xN character vector
   6 
%      * the 0x0 char array ''
   7 
%      * a cell array containing char row vectors or ''
   8 
%   and false otherwise. In particular, ISTEXT returns false if TXT is a cell
   9 
%   array that contains [] in any element, or if TXT is not a row. Note that
  10 
%   the latter is different than how ISCELLSTR behaves.
  11 
%
  12 
%   TF = ISTEXT(TXT,FORBIDCHAR), when FORBIDCHAR is true, returns true only when
  13 
%   TXT is a string array or a cell array containing char row vectors, and false
  14 
%   otherwise. In particular, ISTEXT(TXT,TRUE) returns false if TXT is a char
  15 
%   row vector. This supports pre-string syntaxes where a function requires a
  16 
%   cellstr, and does not accept a raw char row.
  17 
%
  18 
%   TF = ISTEXT(S,FORBIDCHAR,FALSE) returns true only if TXT contains
  19 
%   non-empty, non-missing text, i.e. TXT is
  20 
%      * a string array whose elements not equal to "", all whitespace, or <missing>
  21 
%      * a 1xN character vector for N > 0, not all whitespace
  22 
%      * a cell array containing non-empty, non-missing char row vectors
  23 
%
  24 
%   When TXT is a char row vector, [TF,TXT] = ISTEXT(TXT,...) also returns
  25 
%   {TXT}.  If TXT is a string array or cell array containing char row vectors,
  26 
%   ISTEXT returns TXT itself.  Otherwise, ISTEXT returns a 0x0 cell or string
  27 
%   array in TXT.
  28 
%
  29 
%   See also MATLAB.INTERNAL.DATATYPES.ISSCALARTEXT, ISSPACE, STRINGS.
  30 

  31 
%   Copyright 2017-2018 The MathWorks, Inc.
  32 

  33 
import matlab.internal.datatypes.isCharStrings
  34 
import matlab.internal.datatypes.anyIsAllWhitespace
  35 

< 0.001 
      8 
  36
narginchk(1,3) 
  37 

< 0.001 
      8 
  38
if isstring(txt) 
  39 
    % FORBIDCHAR has no impact on string inputs
  40 
    % ALLOWEMPTYORMISSING needs to be checked only if false
  41 
    if nargin < 3 || varargin{2}
  42 
        tf = true;
  43 
    else  % nargin == 3 && ~varargin{2}
  44 
        % Require all strings to be non-empty and non-missing.
  45 
        if any(ismissing(txt))
  46 
            tf = false;
  47 
            if nargout > 1
  48 
                txt(1:end) = [];
  49 
                txt = reshape(txt,0,0); % faster than string.empty
  50 
            end
  51 
        elseif anyIsAllWhitespace(txt)
  52 
            tf = false;
  53 
            if nargout > 1
  54 
                txt(1:end) = [];
  55 
                txt = reshape(txt,0,0); 
  56 
            end
  57 
        else
  58 
            tf = true;
  59 
        end
  60 
    end    
< 0.001 
      8 
  61
else 
< 0.001 
      8 
  62
    if nargout < 2 
< 0.001 
      8 
  63
        tf = isCharStrings(txt, varargin{:}); 
  64 
    else
  65 
        [tf,txt] = isCharStrings(txt, varargin{:});
< 0.001 
      8 
  66
    end 
< 0.001 
      8 
  67
end 

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