This is a static copy of a profile reportHome
tstr2date (10 calls, 0.022 sec)
Generated 05-Aug-2011 13:00:29 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/dateconv/tstr2date.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
tstr2mjd | function | 10 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
39 | if (dif) | 10 | 0.011 s | 50.0% |  |
35 | end | 60 | 0.011 s | 50.0% |  |
50 | t.sec=c{6}; | 10 | 0 s | 0% |  |
49 | t.min=c{5}; | 10 | 0 s | 0% |  |
48 | t.hour=c{4}; | 10 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.022 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
str2num | function | 50 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.022 s | 100.0% |  |
Totals | | | 0.022 s | 100% | |
Code Analyzer results
Line number | Message |
19 | To improve performance, use logical indexing instead of FIND. |
30 | The variable 'c' appears to change size on every loop iteration. Consider preallocating for speed. |
31 | The variable 'c' appears to change size on every loop iteration. Consider preallocating for speed. |
33 | The variable 'c' appears to change size on every loop iteration. Consider preallocating for speed. |
33 | STR2DOUBLE is faster than STR2NUM; however, STR2DOUBLE operates only on scalars. Use the function that best suits your needs. |
41 | The variable 'c' appears to change size on every loop iteration. Consider preallocating for speed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 50 |
Non-code lines (comments, blank lines) | 22 |
Code lines (lines that can run) | 28 |
Code lines that did run | 22 |
Code lines that did not run | 6 |
Coverage (did run/can run) | 78.57 % |
Function listing
time calls line
1 function t=tstr2date(time)
2
3 % function t=tstr2date(time)
4 %
5 % input time in sza string format, ie 12-JUN-05:12:12:12
6 % and returns struct t:
7 %
8 % t.day=12;
9 % t.month='JUN';
10 % t.year=5;
11 % t.hour=12;
12 % t.min=12;
13 % t.sec=12;
14 %
15 % Michael Loh
16
17 % find all "-' and replace with ':'
10 18 f=find(time=='-');
10 19 time(f)=':';
20
10 21 f=find(time==':');
22
10 23 if (length(f)<4)
24 error('Invalid time')
25 end
26
10 27 f=[0 f length(time)+1];
10 28 for i=2:length(f)
60 29 if (i==3)
10 30 c{i-1}=time(f(2)+1:f(3)-1);
10 31 c{i-1}=upper(c{i-1});
50 32 else
50 33 c{i-1}=str2num(time(f(i-1)+1:f(i)-1));
50 34 end
0.01 60 35 end
36
10 37 cnt=length(c);
10 38 dif=6-cnt;
0.01 10 39 if (dif)
40 for i=1:dif
41 c{cnt+i}=0;
42 end
43 end
44
10 45 t.day=c{1};
10 46 t.month=c{2};
10 47 t.year=c{3};
10 48 t.hour=c{4};
10 49 t.min=c{5};
10 50 t.sec=c{6};