This is a static copy of a profile report

Home

readSpreadsheet>getDataRange (Calls: 2, Time: 0.002 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
readSpreadsheet>handleDataRangesubfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
333
dataRange    = matlab.io.sprea...
20.001 s51.7%
329
[dataRange,type] = sheet.getRa...
20.001 s25.3%
331
case 'single-cell'
20.000 s4.8%
354
dataRange(dataRange < 0) = ...
20.000 s0.2%
356
end
20.000 s0.1%
All other lines  0.000 s17.9%
Totals  0.002 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
subRangefunction20.001 s29.9%
Self time (built-ins, overhead, etc.)  0.001 s70.1%
Totals  0.002 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function45
Non-code lines (comments, blank lines)13
Code lines (lines that can run)32
Code lines that did run19
Code lines that did not run13
Coverage (did run/can run)59.38 %
Function listing
time 
Calls 
 line
 312 
function dataRange = getDataRange(sheet,dataloc,numVars,usedRange,rowsToRequest)
< 0.001 
      2 
 313
    if isempty(usedRange) 
 314 
        usedRange = [1 1 0 0];  
< 0.001 
      2 
 315
    end 
 316 
    
< 0.001 
      2 
 317
    if isempty(dataloc) 
 318 
        dataRange = [1 1 0 0];
< 0.001 
      2 
 319
    else 
< 0.001 
      2 
 320
        if isnumeric(dataloc) && isscalar(dataloc) 
 321 
            % dataloc = Row/Column number
 322 
            usedRange(1) = dataloc; % first row
 323 
            dataRange = matlab.io.spreadsheet.internal.subRange(usedRange,[1 numVars]);
      2 
 324
        else 
< 0.001 
      2 
 325
            if usedRange(3) < rowsToRequest 
 326 
                % get more rows
 327 
                usedRange(3) = usedRange(1) + rowsToRequest - 1;
      2 
 328
            end 
< 0.001 
      2 
 329
            [dataRange,type] = sheet.getRange(dataloc,false); 
      2 
 330
            switch (type) 
< 0.001 
      2 
 331
                case 'single-cell' 
 332 
                    % Start cell, read numVars columns, and all the rows until the end range.
  0.001 
      2 
 333
                    dataRange    = matlab.io.spreadsheet.internal.subRange(dataRange,[1 numVars]); 
 334 
                    % get last usedRange row number
< 0.001 
      2 
 335
                    lastUsedRow  = usedRange(1) + usedRange(3) - 1; 
 336 
                    % set the number of rows
< 0.001 
      2 
 337
                    dataRange(3) = lastUsedRow - dataRange(1) + 1; 
 338 
                case 'row-only'
 339 
                    % Read numVars columns from the first column in the usedRange.
 340 
                    dataRange(2) = usedRange(2);
 341 
                    dataRange = matlab.io.spreadsheet.internal.subRange(dataRange,[1 numVars]);
 342 
                case 'column-only'
 343 
                    
 344 
                case 'named'
 345 
                    if dataRange(4) ~= numVars
 346 
                        error(message('MATLAB:spreadsheet:importoptions:VarNumberMismatch','DataRange'));
 347 
                    end
< 0.001 
      2 
 348
            end 
< 0.001 
      2 
 349
        end 
< 0.001 
      2 
 350
    end 
 351 
    % if the used range is empty, then we may end up with negative values for
 352 
    % the extents [1 1 -1 -1]. Since this is invalid, we replace them with
 353 
    % zero.
< 0.001 
      2 
 354
    dataRange(dataRange < 0) = 0; 
 355 
    
< 0.001 
      2 
 356
end 

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