This is a static copy of a profile reportHome
genfig (9 calls, 26.724 sec)
Generated 05-Aug-2011 13:01:30 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/plotting/genfig.m
Copy to new window for comparing multiple runs
Parents (calling functions)
| Function Name | Function Type | Calls |
| packd | function | 9 |
Lines where the most time was spent
| Line Number | Code | Calls | Total Time | % Time | Time Plot |
| 94 | eval(sprintf('print -dpng -r20... | 24 | 20.614 s | 77.1% |  |
| 72 | [h(pageNum,plotNum),leg]=plotf... | 48 | 2.055 s | 7.7% |  |
| 69 | h(pageNum,plotNum)=plotflag(xc... | 80 | 1.661 s | 6.2% |  |
| 78 | legend(leg,'Location','Best'); | 8 | 1.137 s | 4.3% |  |
| 64 | subplot(matrix(1), matrix(2), ... | 128 | 0.984 s | 3.7% |  |
| All other lines | | | 0.273 s | 1.0% |  |
| Totals | | | 26.724 s | 100% | |
Children (called functions)
Code Analyzer results
| Line number | Message |
| 18 | EXIST with two input arguments is generally faster and clearer than with one input argument. |
| 69 | The variable 'h' appears to change size on every loop iteration. Consider preallocating for speed. |
| 72 | The variable 'h' appears to change size on every loop iteration. Consider preallocating for speed. |
| 77 | Use && instead of & as the AND operator in (scalar) conditional statements. |
| 101 | Loop index 'pageNum' is changed inside of a FOR loop. |
Coverage results
[ Show coverage for parent directory ]
| Total lines in function | 105 |
| Non-code lines (comments, blank lines) | 37 |
| Code lines (lines that can run) | 68 |
| Code lines that did run | 49 |
| Code lines that did not run | 19 |
| Coverage (did run/can run) | 72.06 % |
Function listing
time calls line
1 function genfig(d,flags,xc,txt,ax,type, p, field, saveplot)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function genfig(d,flags,xc,txt,ax,type, p, field, saveplot)
6 %
7 % function that generates figures for a webpage.
8 %
9 % sjcm
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
9 12 if(nargin<9)
13 saveplot = 1;
14 end
15
16
17 % check for axis setting
9 18 if (~exist('ax'))
19 ax=[];
20 end
21
9 22 if(saveplot)
23 % get the directory to write to
9 24 maindir=getmaindir(d, field);
9 25 end
26
27
28 % num is the number of pages to be displayed.
29 % matrix is the size of each of the pages to be displayed.
9 30 if(~p.swap)
9 31 num = size(xc,2);
9 32 plotsPerPage = size(xc{2,1},2);
9 33 if(plotsPerPage==6)
5 34 matrix = [2 3];
4 35 elseif(plotsPerPage==1)
36 matrix = [1 1];
4 37 elseif(plotsPerPage==24)
38 matrix = [2 3];
39 plotsPerPage = 6;
4 40 elseif(plotsPerPage==2)
41 % opacity plots
4 42 matrix = [2 1];
4 43 plotsPerPage = 2;
44 else
45 error('Unrecognized number of plots');
46 end
47 else
48 num = size(xc{2,1},2);
49 plotsPerPage = size(xc,2);
50 matrix = ceil(sqrt(size(xc,2)));
51 matrix = [matrix; matrix];
52 end
53
54 %close all
55
9 56 for pageNum=1:num
57
24 58 if(plotsPerPage==2)
4 59 setwinsize(gcf, 1000, 400);
20 60 else
0.02 20 61 setwinsize(gcf, 1000, 750);
20 62 end
24 63 for plotNum=1:plotsPerPage
0.98 128 64 subplot(matrix(1), matrix(2), plotNum);
65
0.01 128 66 [m,n]=swapIndex(p.swap,pageNum,plotNum);
128 67 switch p.style
128 68 case 'flag'
1.66 80 69 h(pageNum,plotNum)=plotflag(xc,flags,ax,m,n,txt,num,matrix,p.swap);
70
48 71 case 'feature'
2.05 48 72 [h(pageNum,plotNum),leg]=plotfeat(xc,flags,ax,m,n,txt,num, ...
73 matrix,p.swap, p.type);
74
48 75 end
128 76 end
24 77 if (strcmp(p.style,'feature') & ~isempty(leg))
1.14 8 78 legend(leg,'Location','Best');
8 79 leg=[];
8 80 end
24 81 if(length(txt)==5)
0.12 1 82 eval(sprintf('legend(''%s'', ''%s'', ''Location'',''Best'');', ...
83 txt{5}{1}, txt{5}{2}));
1 84 end
85
24 86 if (length(txt)>3)
0.11 24 87 gtitle(txt{4});
24 88 end
89
90
24 91 if(saveplot==1)
24 92 dbclear if error
24 93 set(gcf,'paperposition',[0 0 6.0 6.0])
20.61 24 94 eval(sprintf('print -dpng -r200 %s/%s/fig%u.png;', ...
95 maindir,type,pageNum));
0.01 24 96 dbstop if error
97 else
98 pause(1);
99 end
100
24 101 pageNum=pageNum+1;
24 102 end
103
104
9 105 return;
Other subfunctions in this file are not included in this listing.