This is a static copy of a profile report

Home

DetectImportOptionsSpreadsheet>getHeaderRows (Calls: 2, Time: 0.005 s)
Generated 04-Jun-2021 04:11:09 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\io\spreadsheet\+matlab\+io\+internal\+functions\DetectImportOptionsSpreadsheet.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...rtOptionsSpreadsheet.getOptsFromSheetclass method2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
322
numVars = cummax(arrayfun(@(i)...
20.002 s49.1%
329
headers = detectHeaderLines(do...
20.002 s38.5%
320
blanks = (typeIDs == Sheet.BLA...
20.000 s6.6%
327
numVars(emptyRows) = [];
20.000 s2.5%
324
emptyRows = (numVars == 0);
20.000 s0.0%
All other lines  0.000 s3.3%
Totals  0.005 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
medianfunction20.001 s21.3%
...)max([0,find(~blanks(i,:),1,'last')])anonymous function3210.001 s18.1%
Self time (built-ins, overhead, etc.)  0.003 s60.6%
Totals  0.005 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function28
Non-code lines (comments, blank lines)12
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
 316 
function numHeaderRows = getHeaderRows(typeIDs)
 317 
import matlab.io.internal.text.detectHeaderLines;
 318 
import matlab.io.spreadsheet.internal.Sheet;
 319 

< 0.001 
      2 
 320
blanks = (typeIDs == Sheet.BLANK | typeIDs == Sheet.EMPTY); 
 321 
% Count the number of variables per row
  0.002 
      2 
 322
numVars = cummax(arrayfun(@(i)max([0,find(~blanks(i,:),1,'last')]),1:size(typeIDs,1)))'; 
 323 

< 0.001 
      2 
 324
emptyRows = (numVars == 0); 
 325 

 326 
% Remove Empty Rows for detectHeaderLines
< 0.001 
      2 
 327
numVars(emptyRows) = []; 
 328 

  0.002 
      2 
 329
headers = detectHeaderLines(double(abs(numVars-double(median(uint64(numVars)))))); 
 330 

 331 
% Add the empty rows back in
< 0.001 
      2 
 332
if any(emptyRows) 
 333 
    if headers > 0
 334 
        lastHeader = max([0;find(~emptyRows,headers)]); % Find the last non-empty header row
 335 
    else
 336 
        lastHeader = max([1;find(~emptyRows,1)])-1; 
 337 
    end
 338 
    % take into account empty rows after the last header line.
 339 
    numHeaderRows = lastHeader + max([0,find(~emptyRows((lastHeader+1):end),1)-1]);
< 0.001 
      2 
 340
else 
< 0.001 
      2 
 341
    numHeaderRows = headers; 
< 0.001 
      2 
 342
end 
< 0.001 
      2 
 343
end 

Other subfunctions in this file are not included in this listing.