This is a static copy of a profile report

Home

flagEndpoints (2 calls, 0.044 sec)
Generated 05-Aug-2011 13:03:53 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/flagEndpoints.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
plot1overf>chooseEndPointssubfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
10
delta=f(1,2:n)-f(1,1:n-1);
20.022 s50.0%
12
down=find(delta==-1);
20.011 s25.0%
11
up=find(delta==1);
20.011 s25.0%
25
end
20 s0%
24
indices=transpose([up;down]);
20 s0%
All other lines  0 s0%
Totals  0.044 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function25
Non-code lines (comments, blank lines)11
Code lines (lines that can run)14
Code lines that did run14
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
   time   calls  line
1 function indices=flagEndpoints(flags)
2 %%%%%%%%%%%%%%%%%%%%
3 %
4 % Given a logical array, find the indices of
5 % the starts and ends of cunks of ones.
6 %
7 %%%%%%%%%%%%%%%%%%%%
2 8 n=length(flags);
2 9 f=reshape(flags,1,n);
0.02 2 10 delta=f(1,2:n)-f(1,1:n-1);
0.01 2 11 up=find(delta==1);
0.01 2 12 down=find(delta==-1);
13
14 %Handle edge effects if the first or last
15 %flag indicates a noise event.
2 16 if (f(1)==1)
1 17 up = [0 up];
1 18 end
2 19 up=up+1;
2 20 if (f(n)==1)
1 21 down=[down n];
1 22 end
23
2 24 indices=transpose([up;down]);
2 25 end