This is a static copy of a profile report

Home

validatestring>checkString (2 calls, 0.000 sec)
Generated 05-Nov-2014 07:53:12 using cpu time.
subfunction 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
validatestringfunction2
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
127
end
20 s0%
103
out = out{1};
20 s0%
101
if numel( out ) == 1
20 s0%
99
out = validStrings( strncmpi( ...
20 s0%
86
validateattributes( in, {'char...
20 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function45
Non-code lines (comments, blank lines)21
Code lines (lines that can run)24
Code lines that did run6
Code lines that did not run18
Coverage (did run/can run)25.00 %
Function listing
   time   calls  line
83 function out = checkString( in, validStrings, fname, argDes )
84
2 85 try
2 86 validateattributes( in, {'char'}, {'row'} )
87 catch e
88 % str = 'Expected %s to match one of these strings:\n\n%s\n\nThe input, ''%s'', did not match any of the valid strings.';
89 str = 'Expected %s to match one of these strings:\n\n%s\n\nThe input did not match any of the valid strings.';
90
91 me = MException( matlab.internal.validators.generateId( fname, 'unrecognizedStringChoice' ), ...
92 str, argDes, validStringList( validStrings ) );
93 me = me.addCause( e );
94 throwAsCaller(me);
95 end
96
97 % do a case insensitive search, but use the case from validStrings,
98 % not the case from the input
2 99 out = validStrings( strncmpi( in, validStrings, length(in) ) );
100
2 101 if numel( out ) == 1
102 % unambiguous match
2 103 out = out{1};
104 elseif numel( out ) > 1
105 % possibly ambiguous match
106
107 % determine if all the matching strings are substrings of each other
108 [ ~, shortestMatchIdx] = min( cellfun( @length, out ) );
109 shortestMatch = out{shortestMatchIdx};
110 allSubstrings = all( strncmpi( shortestMatch, out, length(shortestMatch) ) );
111
112 if allSubstrings
113 % return the shortest match
114 out = shortestMatch;
115 else
116 error( matlab.internal.validators.generateId( fname, 'ambiguousStringChoice' ), ...
117 'Expected %s to match one of these strings:\n\n%s\n\nThe input, %s, matched more than one valid string.', ...
118 argDes, validStringList( validStrings ), in )
119 end
120 else
121 % no match found
122 error( matlab.internal.validators.generateId( fname, 'unrecognizedStringChoice' ), ...
123 'Expected %s to match one of these strings:\n\n%s\n\nThe input, ''%s'', did not match any of the valid strings.', ...
124 argDes, validStringList( validStrings ), in );
125 end
126
2 127 end

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