This is a static copy of a profile report

Home

integrateDown (1 call, 17.882 sec)
Generated 05-Aug-2011 13:01:00 using cpu time.
function in file /home/LeechJ/cbass_analysis/comms/integrateDown.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
genfigRmsfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
31
Ystd(k,:) = std(reshape(mean(r...
20017.882 s100.0%
41
end
10 s0%
39
end
2000 s0%
29
Nselect = Nbin*floor(Nsamples/...
2000 s0%
28
if Nbin <= Nsamples/2
2000 s0%
All other lines  0 s0%
Totals  17.882 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
meanfunction2004.700 s26.3%
stdfunction2000.208 s1.2%
Self time (built-ins, overhead, etc.)  12.974 s72.6%
Totals  17.882 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function41
Non-code lines (comments, blank lines)25
Code lines (lines that can run)16
Code lines that did run10
Code lines that did not run6
Coverage (did run/can run)62.50 %
Function listing
   time   calls  line
1 function Ystd = integrateDown(Y,intLength)
2 % Ystd = integrateDown(Y,intLength)
3 %
4 % This function integrates the data down. You pass it two arguments:
5 % Y - MxN matrix of data. The function operates on each column.
6 % intLength - Px1 vector of bin lengths, in terms of number of samples
7 % For each column in Y, this function bins the data into bins whose length
8 % is specified in intLength. It calculates the standard deviation of the
9 % binned data. It does this for each bin length specified in intLength. It
10 % returns the matrix:
11 % Ystd - PxN matrix. Row k corresponds to the standard deviation of the
12 % data when binned by intLength(k) samples. This is given for each
13 % column.
14 %
15 % ogk, 15 June 2011
16
17 % Y is a matrix. We want to apply this calculation to each column of Y.
1 18 Nsamples = size(Y,1);
1 19 intLength = intLength(:); % just in case it's a row vector instead of a column vector
1 20 Ystd = zeros(size(intLength,1),size(Y,2));
21
22 % For each entry in intLength, we want to bin that many samples together,
23 % then calculate the standard deviation of the binned data. This standard
24 % deviation data is returned in Ystd.
25
1 26 for k=1:length(intLength)
200 27 Nbin = intLength(k);
200 28 if Nbin <= Nsamples/2
200 29 Nselect = Nbin*floor(Nsamples/Nbin); % select only these samples, throwing away the rest
30 % Now use the power of MATLAB!
17.88 200 31 Ystd(k,:) = std(reshape(mean(reshape(Y(1:Nselect,:),Nbin,Nselect/Nbin,size(Y,2)),1),Nselect/Nbin,size(Y,2),1),0,1);
32 else
33 % Cannot calculate a standard deviation, return NaN's
34 disp('Error in function: integrateDown(Y,intLength).')
35 fprintf('You have asked for bins of length %d, but there are only %d samples.\n',Nbin,Nsamples)
36 disp('This makes it impossible to calculate a standard deviation. Sorry. Assigning NaNs.')
37 Ystd(k,:) = nan;
38 end
200 39 end
40
1 41 end