This is a static copy of a profile report

Home

readSpreadsheet>handleReplacement (Calls: 2, Time: 0.006 s)
Generated 04-Jun-2021 04:11:24 using performance time.
subfunction in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\io\spreadsheet\+matlab\+io\+spreadsheet\+internal\readSpreadsheet.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
readSpreadsheetfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
115
processRules(missingIDs,missin...
10.005 s85.7%
81
omitRecords = false(rows,1);
20.000 s3.4%
131
end
20.000 s3.0%
114
if any(missingIDs(:))
20.000 s1.1%
80
omitVars = false(1,cols);
20.000 s0.9%
All other lines  0.000 s5.8%
Totals  0.006 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...eet>handleReplacement/processRulesnested function10.005 s80.7%
Self time (built-ins, overhead, etc.)  0.001 s19.3%
Totals  0.006 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function57
Non-code lines (comments, blank lines)36
Code lines (lines that can run)21
Code lines that did run14
Code lines that did not run7
Coverage (did run/can run)66.67 %
Function listing
time 
Calls 
 line
  75 
function [variables,metadata,omitVars] = handleReplacement(variables,metadata,varOpts,importErrorRule,missingRule,errorIDs,missingIDs)
  76 
    
  77 
    % Used for handling replacement rules
< 0.001 
      2 
  78
    cols = length(variables); 
< 0.001 
      2 
  79
    rows = size(errorIDs,1); 
< 0.001 
      2 
  80
    omitVars = false(1,cols); 
< 0.001 
      2 
  81
    omitRecords = false(rows,1); 
  82 
    
  83 
    function processRules(ids,rule,errFcn)
  84 
        switch(rule)
  85 
            case 'error'
  86 
                rowK = find(any(ids,2),1);
  87 
                colK = find(ids(rowK,:),1);
  88 
                errFcn(varOpts{colK}.Type,rowK,colK);
  89 
            case 'fill'
  90 
                % Replace fill value
  91 
                for k = 1:numel(variables)
  92 
                    % Replace fill value
  93 
                    fill = varOpts{k}.FillValue;
  94 
                    [fill,variables{k}] = matlab.io.internal.processRawFill(fill,variables{k});
  95 
                    if ~all(ids(:,k) == 0)
  96 
                        variables{k}(ids(:,k)) = fill;
  97 
                    end
  98 
                end
  99 
            case 'omitvar'
 100 
                % set the selected variable ID to zero so it can be filtered later.
 101 
                omitVars(:,any(ids,1)) = true;
 102 
            case 'omitrow'
 103 
                % Collect record numbers which need to be omitted
 104 
                omitRecords(any(ids,2),:) = true;
 105 
        end
 106 
    end
 107 
    
 108 
    % Handle any error
 109 
    
< 0.001 
      2 
 110
    if any(errorIDs(:)) 
 111 
        processRules(errorIDs,importErrorRule,@(type,rowNum,colNum)errorRuleError(colNum,rowNum,type));
< 0.001 
      2 
 112
    end 
 113 
    
< 0.001 
      2 
 114
    if any(missingIDs(:)) 
  0.005 
      1 
 115
        processRules(missingIDs,missingRule,@(~,rowNum,colNum)missingRuleError(colNum,rowNum)); 
< 0.001 
      2 
 116
    end 
 117 
    
 118 
    % Remove omitted variables
< 0.001 
      2 
 119
    if any(omitVars) 
 120 
        variables(:,omitVars) = [];
 121 
        metadata.VariableNames(omitVars(1:numel(metadata.VariableNames))) = [];
< 0.001 
      2 
 122
    end 
 123 
    
 124 
    % handle omit-records
< 0.001 
      2 
 125
    if any(omitRecords) 
 126 
        for i = 1:numel(variables)
 127 
            variables{i}(omitRecords) = [];
 128 
        end
 129 
        metadata.RowNames(omitRecords(1:numel(metadata.RowNames))) = [];
< 0.001 
      2 
 130
    end 
< 0.001 
      2 
 131
end 

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