This is a static copy of a profile reportHome
timefun/private/cnv2icudf (80 calls, 0.066 sec)
Generated 05-Aug-2011 13:01:27 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/timefun/private/cnv2icudf.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
98 | dtstr =regexprep(dtstr, '(d{1,... | 80 | 0.044 s | 66.7% |  |
99 | end | 80 | 0.011 s | 16.7% |  |
72 | if (wrtYr ~= 4 && wrt... | 80 | 0.011 s | 16.7% |  |
124 | if wrtMsec > 0 | 80 | 0 s | 0% |  |
123 | end | 80 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.066 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
97 | Variable 'replace', apparently a structure, is changed but the value seems to be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 130 |
Non-code lines (comments, blank lines) | 47 |
Code lines (lines that can run) | 83 |
Code lines that did run | 45 |
Code lines that did not run | 38 |
Coverage (did run/can run) | 54.22 % |
Function listing
time calls line
1 function [dtstr] = cnv2icudf(formatstr)
2 % CNV2ICUDF maps date format tokens to ICU date format tokens
3 % [ICUFORMAT] = CNV2ICUDF(MLFORMAT) turns the date
4 % format into a date format that uses the format tokens of the ICU Libraries
5 %
6 % INPUT PARAMETERS:
7 % MLFORMAT: char string containing a user specified date format
8 % string. See NOTE 1.
9 %
10 % RETURN PARAMETERS:
11 % ICUFORMAT: char string, containing date and, optionally, time formated
12 % as per user specified format string.
13 %
14 % EXAMPLES:
15 %
16 %
17 % NOTE 1: The format specifier allows free-style date format, within the
18 % following limits -
19 % ddd => day is formatted as abbreviated name of weekday
20 % dd => day is formatted as two digit day of month
21 % d => day is formatted as first letter of day of month
22 % mmm => month is formatted as three letter abbreviation of name of month
23 % mm => month is formatted as two digit month of year
24 % m => month is formatted as one or two digit month of year
25 % yyyy => year is formatted as four digit year
26 % yy => year is formatted as two digit year
27 % HH => hour is formatted as two digit hour of the day
28 % MM => minute is formatted as two digit minute of the hour
29 % SS => second is formatted as two digit second of the minute
30 % The user may use any separator and other delimiters of his liking, but
31 % must confine himself to the above format tokens regarding day, month,
32 % year, hour, minute and second.
33 %
34 %
35 %------------------------------------------------------------------------------
36
37 % Copyright 2002-2007 The MathWorks, Inc.
38
80 39 if isempty(formatstr)
40 dtstr = '';
41 return
80 42 else
80 43 dtstr = formatstr;
80 44 end
45
80 46 notAMPM = isempty(strfind(formatstr,'AM')) && isempty(strfind(formatstr,'PM'));
47
80 48 if notAMPM
49 else
50 dtstr = strrep(dtstr,'AM','a'); % remove AM to avoid confusion below
51 dtstr = strrep(dtstr,'PM','a'); % remove PM to avoid confusion below
52 end
53
80 54 showyr = strfind(dtstr,'y'); wrtYr = numel(showyr);
80 55 showmo = strfind(dtstr,'m'); wrtMo = numel(showmo);
80 56 showday = strfind(dtstr,'d'); wrtDay = numel(showday);
80 57 showhr = strfind(dtstr,'H'); wrtHr = numel(showhr);
80 58 showmin = strfind(dtstr,'M'); wrtMin = numel(showmin);
80 59 showsec = strfind(dtstr,'S'); wrtSec = numel(showsec);
80 60 showMsec = strfind(dtstr,'F'); wrtMsec = numel(showMsec);
80 61 showqrt = strfind(dtstr,'Q'); wrtQrt = numel(showqrt);
80 62 showT = strfind(dtstr,'T'); wrtT = numel(showT);
63
80 64 dtstr = strrep(dtstr,'M','N'); % to avoid confusion with ICU month tokens
65
80 66 if(wrtT > 0)
67 dtstr = strrep(dtstr,'T','''T''');
68 end
69
70 % Format date
80 71 if wrtYr > 0
0.01 80 72 if (wrtYr ~= 4 && wrtYr ~= 2) || showyr(end) - showyr(1) >= wrtYr
73 error('MATLAB:datestr:yearFormat','Unrecognized year format.');
74 end
80 75 end
80 76 if wrtQrt > 0
77 if wrtQrt == 2 && showqrt(2) - showqrt(1) == 1
78 dtstr = strrep(dtstr,'QQ','MM');
79 else
80 error('MATLAB:datestr:quarterFormat','Unrecognized quarter format.');
81 end
82 if wrtMo > 0 || wrtDay > 0 || wrtHr > 0 || wrtMin > 0 || wrtSec > 0
83 error('MATLAB:datestr:quarterFormat',...
84 'Cannot use other time and date fields besides year and quarter.');
85 end
86 end
80 87 if wrtMo > 0
80 88 if wrtMo > 4 || showmo(end) - showmo(1) >= wrtMo
89 error(message('MATLAB:datestr:monthFormat'));
90 end
80 91 dtstr = strrep(dtstr,'m','M');
80 92 end
80 93 if wrtDay > 0
80 94 replace.dddd = 'EEEE';
80 95 replace.ddd = 'EEE';
80 96 replace.d = 'E';
80 97 replace.dd = 'dd';
0.04 80 98 dtstr =regexprep(dtstr, '(d{1,4})', '${replace.($0)}');
0.01 80 99 end
100 % Format time
80 101 if wrtHr > 0
80 102 if wrtHr == 2 && showhr(end) - showhr(1) < wrtHr
80 103 if ~notAMPM
104 dtstr = strrep(dtstr,'H','h');
105 end
106 else
107 error(message('MATLAB:datestr:hourFormat'));
108 end
80 109 end
80 110 if wrtMin > 0
80 111 if wrtMin == 2 && showmin(end) - showmin(1) < wrtMin
80 112 dtstr = strrep(dtstr,'N','m');
113 else
114 error(message('MATLAB:datestr:minuteFormat'));
115 end
80 116 end
80 117 if wrtSec > 0
80 118 if wrtSec == 2 && showsec(end) - showsec(1) < wrtSec
80 119 dtstr = strrep(dtstr,'S','s');
120 else
121 error(message('MATLAB:datestr:secondFormat'));
122 end
80 123 end
80 124 if wrtMsec > 0
125 if wrtMsec == 3 && showMsec(end) - showMsec(1) < wrtMsec
126 dtstr = strrep(dtstr,'F','S');
127 else
128 error(message('MATLAB:datestr:millisecondFormat'));
129 end
130 end