This is a static copy of a profile reportHome
searchStruct (2 calls, 0.022 sec)
Generated 05-Aug-2011 13:01:02 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/searchStruct.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 |
28 | str=strcat(str,sprintf('.%s',f... | 5 | 0.022 s | 100.0% |  |
32 | f=1; | 2 | 0 s | 0% |  |
30 | end | 5 | 0 s | 0% |  |
29 | c=c+1; | 5 | 0 s | 0% |  |
24 | if (t==0) | 5 | 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 |
strcat | function | 5 | 0.011 s | 50.0% |  |
Self time (built-ins, overhead, etc.) | | | 0.011 s | 50.0% |  |
Totals | | | 0.022 s | 100% | |
Code Analyzer results
Line number | Message |
1 | Input argument 's' might be unused, although a later one is used. Consider replacing it by ~. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 32 |
Non-code lines (comments, blank lines) | 19 |
Code lines (lines that can run) | 13 |
Code lines that did run | 10 |
Code lines that did not run | 3 |
Coverage (did run/can run) | 76.92 % |
Function listing
time calls line
1 function f=searchStruct(s,field)
2
3 %function f=searchStruct(d,field)
4 %
5 %Searches a struct for specified fields. Acts like a recursive
6 %'isfield' searching down the struct chain.
7 %
8 %For example: s.a.b.c, field={'a','b','c'}
9 %
10 %Input:
11 % s - structure
12 % field - cell array of fields to search.
13 %
14 %Output:
15 % f - 1 if true, 0 if false
16 %
17 %Author: Michael Loh
18
2 19 cnt=length(field);
2 20 c=1;
2 21 str=sprintf('s');
2 22 while(c<=cnt)
5 23 t=isfield(eval(str),field{c});
5 24 if (t==0)
25 f=0;
26 return
27 end
0.02 5 28 str=strcat(str,sprintf('.%s',field{c}));
5 29 c=c+1;
5 30 end
31
2 32 f=1;