This is a static copy of a profile report

Home

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)

Function NameFunction TypeCalls
reduceData>matchRevsubfunction1
reduceDatafunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
28
str=strcat(str,sprintf('.%s',f...
50.022 s100.0%
32
f=1;
20 s0%
30
end
50 s0%
29
c=c+1;
50 s0%
24
if (t==0)
50 s0%
All other lines  0 s0%
Totals  0.022 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
strcatfunction50.011 s50.0%
Self time (built-ins, overhead, etc.)  0.011 s50.0%
Totals  0.022 s100% 
Code Analyzer results
Line numberMessage
1Input 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 function32
Non-code lines (comments, blank lines)19
Code lines (lines that can run)13
Code lines that did run10
Code lines that did not run3
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;