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
Function Name | Function Type | Calls |
...rtOptionsSpreadsheet.getOptsFromSheet | class method | 2 |
Line Number | Code | Calls | Total Time | % Time | Time Plot |
322 | numVars = cummax(arrayfun(@(i)... | 2 | 0.002 s | 49.1% | |
329 | headers = detectHeaderLines(do... | 2 | 0.002 s | 38.5% | |
320 | blanks = (typeIDs == Sheet.BLA... | 2 | 0.000 s | 6.6% | |
327 | numVars(emptyRows) = []; | 2 | 0.000 s | 2.5% | |
324 | emptyRows = (numVars == 0); | 2 | 0.000 s | 0.0% | |
All other lines | 0.000 s | 3.3% | |||
Totals | 0.005 s | 100% |
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
median | function | 2 | 0.001 s | 21.3% | |
...)max([0,find(~blanks(i,:),1,'last')]) | anonymous function | 321 | 0.001 s | 18.1% | |
Self time (built-ins, overhead, etc.) | 0.003 s | 60.6% | |||
Totals | 0.005 s | 100% |
Total lines in function | 28 |
Non-code lines (comments, blank lines) | 12 |
Code lines (lines that can run) | 16 |
Code lines that did run | 10 |
Code lines that did not run | 6 |
Coverage (did run/can run) | 62.50 % |
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.