This is a static copy of a profile reportHome
mjd2string (98 calls, 0.153 sec)
Generated 05-Aug-2011 13:00:35 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/dateconv/mjd2string.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 |
67 | str = cat(2, num2str(times.day... | 98 | 0.033 s | 21.4% |  |
51 | times.minuteString = num2str(t... | 98 | 0.022 s | 14.3% |  |
43 | times.hourString = num2str(tim... | 98 | 0.022 s | 14.3% |  |
17 | dash = repmat(['-'], size(time... | 98 | 0.022 s | 14.3% |  |
12 | times = mjd2date_v2(times); | 98 | 0.022 s | 14.3% |  |
All other lines | | | 0.033 s | 21.4% |  |
Totals | | | 0.153 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
num2str | function | 490 | 0.066 s | 42.9% |  |
mjd2date_v2 | function | 98 | 0.022 s | 14.3% |  |
repmat | function | 196 | 0.011 s | 7.1% |  |
Self time (built-ins, overhead, etc.) | | | 0.055 s | 35.7% |  |
Totals | | | 0.153 s | 100% | |
Code Analyzer results
Line number | Message |
17 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
18 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 71 |
Non-code lines (comments, blank lines) | 20 |
Code lines (lines that can run) | 51 |
Code lines that did run | 38 |
Code lines that did not run | 13 |
Coverage (did run/can run) | 74.51 % |
Function listing
time calls line
1 function times = mjd2string(times)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % function times = mjd2str(times)
5 %
6 % converst mjd to strings that can be read into read_arc
7 %
8 % sjcm
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
98 11 s = size(times,1);
0.02 98 12 times = mjd2date_v2(times);
13
98 14 months = ['JAN'; 'FEB'; 'MAR'; 'APR'; 'MAY'; 'JUN'; 'JUL'; 'AUG'; ...
15 'SEP'; 'OCT'; 'NOV'; 'DEC'];
98 16 times.month = months(times.month,:);
0.02 98 17 dash = repmat(['-'], size(times.day));
0.01 98 18 colon = repmat([':'], size(times.day));
98 19 if(s==1)
98 20 times.second(1) = floor(times.second(1));
21 else
22 times.second(1:s/2) = floor(times.second(1:s/2));
23 times.second(s/2+1:s) = ceil(times.second(s/2+1:s));
24 end
25
98 26 f = find(times.second ==60) ;
98 27 if(~isempty(f))
28 times.second(f) = 0;
29 times.minute(f) = times.minute(f)+1;
30 end
0.01 98 31 f = find(times.minute == 60);
98 32 if(~isempty(f))
33 times.minute(f) = 0;
34 times.hour(f) = times.hour(f) + 1;
35 end
98 36 f = find(times.hour == 24);
98 37 if(~isempty(f))
38 times.hour(f) = 0;
39 times.day(f) = times.day(f) + 1;
40 end
41 % yes...i know it will have a problem with months...but it shouldn't since we are just doing the arrayHealht on a given day.
42
0.02 98 43 times.hourString = num2str(times.hour);
98 44 f = find(times.hour<10);
98 45 if(~isempty(f))
98 46 for m=1:length(f)
0.01 98 47 times.hourString(f(m),1:2) = sprintf('0%d', times.hour(f(m),:));
98 48 end
98 49 end
50
0.02 98 51 times.minuteString = num2str(times.minute);
98 52 f = find(times.minute<10);
98 53 if(~isempty(f))
17 54 for m=1:length(f)
17 55 times.minuteString(f(m),1:2) = sprintf('0%d', times.minute(f(m),:));
17 56 end
17 57 end
58
98 59 times.secondString = num2str(times.second);
98 60 f = find(times.second<10);
98 61 if(~isempty(f))
19 62 for m=1:length(f)
19 63 times.secondString(f(m),1:2) = sprintf('0%d', times.second(f(m),:));
19 64 end
19 65 end
66
0.03 98 67 str = cat(2, num2str(times.day), dash, times.month, dash, num2str(times.year), colon, times.hourString, colon, times.minuteString, colon, times.secondString);
68
98 69 times = str;
70
98 71 return