This is a static copy of a profile reportHome
buffields (27 calls, 0.044 sec)
Generated 05-Aug-2011 13:01:01 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/buffields.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 |
20 | s=rmfield(s,fd{i}); | 90 | 0.044 s | 100.0% |  |
41 | end | 108 | 0 s | 0% |  |
21 | end | 90 | 0 s | 0% |  |
19 | eval(sprintf('b.%s=s.%s;', cha... | 90 | 0 s | 0% |  |
18 | if (isfield(s,fd{i})) | 108 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.044 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
rmfield | function | 90 | 0.033 s | 75.0% |  |
Self time (built-ins, overhead, etc.) | | | 0.011 s | 25.0% |  |
Totals | | | 0.044 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 41 |
Non-code lines (comments, blank lines) | 14 |
Code lines (lines that can run) | 27 |
Code lines that did run | 8 |
Code lines that did not run | 19 |
Coverage (did run/can run) | 29.63 % |
Function listing
time calls line
1 function [s,b]=buffields(s,fd)
2
3 % function [s,b]=buffields(s,fd)
4 %
5 % removes field specified in fd from structure s and stores field
6 % values and names in buffered structure, b.
7 %
8 % s - input structure
9 % fd - cell array of field names, {{'vis'},{'flags','visFlag'}}}
10 % - will remove fields vis, and flag.visFlag
11 % b - structure with fields specified in fd
12 %
13 % Michael Loh
14
27 15 b=[];
27 16 for i=1:length(fd)
108 17 if (length(fd{i})==1)
108 18 if (isfield(s,fd{i}))
90 19 eval(sprintf('b.%s=s.%s;', char(fd{i}), char(fd{i})));
0.04 90 20 s=rmfield(s,fd{i});
90 21 end
22 else
23 rm=1;
24 for j=1:length(fd{i})
25 if (j==1)
26 str='';
27 else
28 str=strcat(str,sprintf('.%s',char(fd{i}{j-1})));
29 end
30 if (~eval(sprintf('isfield(s%s,''%s'')',str,char(fd{i}{j}))))
31 rm=0;
32 break;
33 end
34 end
35 if (rm)
36 str2=strcat(str,sprintf('.%s',char(fd{i}{j})));
37 eval(sprintf('b%s=s%s;', str2, str2));
38 eval(sprintf('s%s=rmfield(s%s,fd{i}{j});',str,str));
39 end
40 end
108 41 end