This is a static copy of a profile report

Home

readSpreadsheet>handleDataRange (Calls: 2, Time: 0.025 s)
Generated 04-Jun-2021 04:11:23 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
296
[vars,mIDs,eIDs] = readDataFro...
20.012 s50.1%
295
varopts = getVarOptsStruct(opt...
20.006 s25.7%
294
dataRange = getDataRange(sheet...
20.002 s9.5%
293
numVars = numel(opts.VariableN...
20.001 s2.7%
307
variables{i} = vertcat(varchun...
60.000 s1.7%
All other lines  0.003 s10.3%
Totals  0.025 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
readSpreadsheet>readDataFromSheetsubfunction20.012 s48.6%
...ons>ImportOptions.getVarOptsStructclass method20.006 s23.7%
readSpreadsheet>getDataRangesubfunction20.002 s8.5%
...ns>ImportOptions.get.VariableNamesclass method20.000 s0.8%
Self time (built-ins, overhead, etc.)  0.005 s18.3%
Totals  0.025 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function52
Non-code lines (comments, blank lines)8
Code lines (lines that can run)44
Code lines that did run35
Code lines that did not run9
Coverage (did run/can run)79.55 %
Function listing
time 
Calls 
 line
 259 
function [variables,errorIDs,missingIDs,dataRange] = handleDataRange(selectedIDs, opts, sheet, rowsToRequest, useExcelFlag)
< 0.001 
      2 
 260
    numvars = numel(selectedIDs); 
< 0.001 
      2 
 261
    numRanges = size(opts.DataRange,1); 
 262 
    
 263 
    % Get the data range and remove headers and footers
< 0.001 
      2 
 264
    if(~useExcelFlag) 
< 0.001 
      2 
 265
        usedRangeStr = sheet.getDataSpan; 
      2 
 266
        if isempty(usedRangeStr) 
 267 
            usedRange = [];
< 0.001 
      2 
 268
        else 
< 0.001 
      2 
 269
            usedRange = sheet.getRange(usedRangeStr, false); 
< 0.001 
      2 
 270
        end 
 271 
    else
 272 
        [~, ~, usedRange] = matlab.io.spreadsheet.internal.usedDataRange(sheet);
< 0.001 
      2 
 273
    end 
 274 
    
< 0.001 
      2 
 275
    varchunks = []; 
< 0.001 
      2 
 276
    missingIDs = logical.empty(0,numvars); 
< 0.001 
      2 
 277
    errorIDs = logical.empty(0,numvars); 
 278 
    % find the datarange
< 0.001 
      2 
 279
    for i = 1:numRanges 
< 0.001 
      2 
 280
        range = convertStringsToChars(opts.DataRange(i,:)); 
< 0.001 
      2 
 281
        if iscell(range) 
 282 
            range = range{:};
< 0.001 
      2 
 283
        elseif ~isscalar(range) && isnumeric(range) 
 284 
            % replace inf with the end of the usedRange
 285 
            if any(isinf(range))
 286 
                range(2) = usedRange(1) + usedRange(3) - 1;
 287 
            end
 288 
            range = [num2str(range(1)),':',num2str(range(2))];
< 0.001 
      2 
 289
        end 
< 0.001 
      2 
 290
        if numel(usedRange) > 2 
< 0.001 
      2 
 291
            rowsToRequest = min(rowsToRequest,usedRange(3)-usedRange(1)); 
      2 
 292
        end 
< 0.001 
      2 
 293
        numVars = numel(opts.VariableNames); 
  0.002 
      2 
 294
        dataRange = getDataRange(sheet,range,numVars,usedRange,rowsToRequest); 
  0.006 
      2 
 295
        varopts = getVarOptsStruct(opts,1:numVars); 
  0.012 
      2 
 296
        [vars,mIDs,eIDs] = readDataFromSheet(sheet,dataRange,varopts,selectedIDs); 
< 0.001 
      2 
 297
        varchunks = [varchunks; vars]; %#ok<AGROW> 
< 0.001 
      2 
 298
        missingIDs = [missingIDs; mIDs]; %#ok<AGROW> 
< 0.001 
      2 
 299
        errorIDs = [errorIDs; eIDs]; %#ok<AGROW> 
< 0.001 
      2 
 300
    end 
< 0.001 
      2 
 301
    if numRanges == 0 
 302 
        dataRange = '';
< 0.001 
      2 
 303
    end 
< 0.001 
      2 
 304
    variables = cell(0,numvars); 
 305 
    % clean up variables
< 0.001 
      2 
 306
    for i = 1:numvars 
< 0.001 
      6 
 307
        variables{i} = vertcat(varchunks{:,i}); 
< 0.001 
      6 
 308
    end 
 309 

< 0.001 
      2 
 310
end 

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