This is a static copy of a profile report

Home

validatestring (6 calls, 0.000 sec)
Generated 14-Nov-2016 07:47:24 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/lang/validatestring.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imagesci/private/writepngfunction6
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
80
end
60 s0%
65
out = checkString( in, validSt...
60 s0%
63
try    
60 s0%
57
[ in, validStrings, optional_i...
60 s0%
56
try
60 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
validatestring>checkStringsubfunction60 s0%
validatestring>checkInputssubfunction60 s0%
Self time (built-ins, overhead, etc.)  0 s0%
Totals  0 s0% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function80
Non-code lines (comments, blank lines)63
Code lines (lines that can run)17
Code lines that did run6
Code lines that did not run11
Coverage (did run/can run)35.29 %
Function listing
time 
calls 
 line
   1 
function out = validatestring( varargin )
   2 
%VALIDATESTRING Check validity of text string.
   3 
%   VALIDSTR = VALIDATESTRING(STR,VALID_STRINGS) checks the validity of
   4 
%   text string STR. If STR is an unambiguous, case-insensitive match to
   5 
%   one or more strings in cell array VALID_STRINGS, VALIDATESTRING returns
   6 
%   the matching string in VALIDSTR. Otherwise, VALIDATESTRING issues a
   7 
%   formatted error message.
   8 
%
   9 
%   VALIDSTR = VALIDATESTRING(STR,VALID_STRINGS,ARG_INDEX) includes the 
  10 
%   position of the input in your function argument list as part of any
  11 
%   generated error messages.
  12 
%
  13 
%   VALIDSTR = VALIDATESTRING(STR,VALID_STRINGS,FUNC_NAME) includes the 
  14 
%   specified function name in generated error identifiers.
  15 
%
  16 
%   VALIDSTR = VALIDATESTRING(STR,VALID_STRINGS,FUNC_NAME,VAR_NAME) includes 
  17 
%   the specified variable name in generated error messages.
  18 
%
  19 
%   VALIDSTR = VALIDATESTRING(STR,VALID_STRINGS,FUNC_NAME,VAR_NAME,ARG_INDEX) 
  20 
%   includes the specified information in the generated error messages or
  21 
%   identifiers.
  22 
%
  23 
%   Input Arguments:
  24 
%
  25 
%   VALID_STRINGS   Cell array of text strings.
  26 
%
  27 
%   ARG_INDEX       Positive integer that specifies the position of the
  28 
%                   input argument.
  29 
%
  30 
%   FUNC_NAME       String that specifies the function name. If you specify
  31 
%                   an empty string, '', FUNCNAME is ignored.
  32 
%
  33 
%   VAR_NAME        String that specifies input argument name. If you 
  34 
%                   specify an empty string, '', VARNAME is ignored.
  35 
%
  36 
%   Example: Define a cell array of text strings, and pass in another
  37 
%            string that is not in the cell array.
  38 
%
  39 
%       validatestring('C',{'A','B'},'func_name','var_name',2)
  40 
%
  41 
%   This code throws an error and displays a formatted message:
  42 
%
  43 
%       Error using func_name
  44 
%       Expected argument 2, var_name, to match one of these strings:
  45 
%
  46 
%         A, B
  47 
%
  48 
%       The input, 'C', did not match any of the valid strings.
  49 
%
  50 
%   See also validateattributes, inputParser.
  51 

  52 
%   Copyright 1993-2014 The MathWorks, Inc.
  53 

      6 
  54 
narginchk(2,5); 
  55 

      6 
  56 
try 
      6 
  57 
    [ in, validStrings, optional_inputs ] = checkInputs( varargin ); 
  58 
catch e
  59 
    % only VALIDATESTRING should be on the stack
  60 
    throw(e)
  61 
end
  62 

      6 
  63 
try     
  64 
    % check the contents of IN
      6 
  65 
    out = checkString( in, validStrings, optional_inputs); 
  66 
    
  67 
catch e
  68 
    myId = 'MATLAB:validatestring:';
  69 
    if strncmp( myId, e.identifier, length(myId) )
  70 
        % leave VALIDATESTRING on the stack, because there was a misuse
  71 
        % of VALIDATESTRING itself
  72 
        throw(e)
  73 
    else
  74 
        % strip VALIDATESTRING off the stack so that the error looks like
  75 
        % it comes from the caller just as if it had hand-coded its input checking
  76 
        throwAsCaller( e )
  77 
    end
  78 
end
  79 

      6 
  80 
end 

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