This is a static copy of a profile report

Home

validatestring (2 calls, 0.010 sec)
Generated 05-Nov-2014 07:53:12 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/lang/validatestring.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
iptgetpreffunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
58
[ in, validStrings, fname, arg...
20.010 s100.0%
81
end
20 s0%
66
out = checkString( in, validSt...
20 s0%
64
try    
20 s0%
57
try
20 s0%
All other lines  0 s0%
Totals  0.010 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
validatestring>checkInputssubfunction20.010 s100.0%
validatestring>checkStringsubfunction20 s0%
Self time (built-ins, overhead, etc.)  0 s0%
Totals  0.010 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function81
Non-code lines (comments, blank lines)64
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-2011 The MathWorks, Inc.
53 % $Revision: 1.1.6.7 $ $Date: 2011/04/16 06:39:29 $
54
2 55 narginchk(2,5);
56
2 57 try
0.01 2 58 [ in, validStrings, fname, argDes ] = checkInputs( varargin );
59 catch e
60 % only VALIDATESTRING should be on the stack
61 throw(e)
62 end
63
2 64 try
65 % check the contents of IN
2 66 out = checkString( in, validStrings, fname, argDes );
67
68 catch e
69 myId = 'MATLAB:validatestring:';
70 if strncmp( myId, e.identifier, length(myId) )
71 % leave VALIDATESTRING on the stack, because there was a misuse
72 % of VALIDATESTRING itself
73 throw(e)
74 else
75 % strip VALIDATESTRING off the stack so that the error looks like
76 % it comes from the caller just as if it had hand-coded its input checking
77 throwAsCaller( e )
78 end
79 end
80
2 81 end

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