This is a static copy of a profile report

Home

strtok (4 calls, 0.011 sec)
Generated 05-Aug-2011 13:01:21 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/strfun/strtok.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
finfofunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
70
if (nargout == 2)
40 s0%
68
token = string(start:finish);
40 s0%
66
finish = i - 1;
40 s0%
65
end
80 s0%
63
break, 
40 s0%
All other lines  0.011 s100.0%
Totals  0.011 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function72
Non-code lines (comments, blank lines)42
Code lines (lines that can run)30
Code lines that did run19
Code lines that did not run11
Coverage (did run/can run)63.33 %
Function listing
   time   calls  line
1 function [token, remainder] = strtok(string, delimiters)
2 %STRTOK Find token in string.
3 % TOKEN = STRTOK(STR) returns the first token in the string STR delimited
4 % by white-space characters. STRTOK ignores any leading white space.
5 % If STR is a cell array of strings, TOKEN is a cell array of tokens.
6 %
7 % TOKEN = STRTOK(STR,DELIM) returns the first token delimited by one of
8 % the characters in DELIM. STRTOK ignores any leading delimiters.
9 % Do not use escape sequences as delimiters. For example, use char(9)
10 % rather than '\t' for tab.
11 %
12 % [TOKEN,REMAIN] = STRTOK(...) returns the remainder of the original
13 % string.
14 %
15 % If the body of the input string does not contain any delimiter
16 % characters, STRTOK returns the entire string in TOKEN (excluding any
17 % leading delimiter characters), and REMAIN contains an empty string.
18 %
19 % Example:
20 %
21 % s = ' This is a simple example.';
22 % [token, remain] = strtok(s)
23 %
24 % returns
25 %
26 % token =
27 % This
28 % remain =
29 % is a simple example.
30 %
31 % See also ISSPACE, STRFIND, STRNCMP, STRCMP, TEXTSCAN.
32
33 % Copyright 1984-2009 The MathWorks, Inc.
34 % $Revision: 5.14.4.8 $ $Date: 2010/08/23 23:13:29 $
35
4 36 if nargin<1
37 error(message('MATLAB:strtok:NrInputArguments'));
38 end
39
4 40 token = ''; remainder = '';
41
4 42 len = length(string);
4 43 if len == 0
44 return
45 end
46
4 47 if (nargin == 1)
48 delimiters = [9:13 32]; % White space characters
49 end
50
4 51 i = 1;
4 52 while (any(string(i) == delimiters))
4 53 i = i + 1;
4 54 if (i > len),
55 return,
56 end
4 57 end
58
4 59 start = i;
4 60 while (~any(string(i) == delimiters))
12 61 i = i + 1;
12 62 if (i > len),
4 63 break,
64 end
8 65 end
4 66 finish = i - 1;
67
4 68 token = string(start:finish);
69
4 70 if (nargout == 2)
71 remainder = string(finish + 1:length(string));
72 end