This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
readSpreadsheetVariablefunction3
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
72
var(typeIDs == sheet.BLANK | t...
30.001 s20.6%
69
data = sheet.readNumbers(subra...
30.000 s10.2%
68
if any(numbermask,'all')
30.000 s8.6%
70
var(numbermask) = data(numberm...
30.000 s6.1%
29
var = zeros(size(typeIDs), var...
30.000 s4.9%
All other lines  0.001 s49.5%
Totals  0.002 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function47
Non-code lines (comments, blank lines)13
Code lines (lines that can run)34
Code lines that did run21
Code lines that did not run13
Coverage (did run/can run)61.76 %
Function listing
time 
Calls 
 line
  27 
function [var,errid,placeholder] = readNumericSpreadsheetVariable(varopts,sheet,subrange,typeIDs)
  28 
% Create an empty vector to hold our results
< 0.001 
      3 
  29
var = zeros(size(typeIDs), varopts.Type); 
  30 

  31 
% Initialize errid logical vector
< 0.001 
      3 
  32
errid = false(size(typeIDs)); 
< 0.001 
      3 
  33
placeholder = false(size(typeIDs)); 
  34 

< 0.001 
      3 
  35
textmask = typeIDs == sheet.STRING; 
< 0.001 
      3 
  36
if any(textmask,'all') 
  37 
    % Read the string data
  38 
    data = sheet.readStrings(subrange);
  39 
    for i = 1:size(data,2)
  40 
        textmaskInd = textmask(:,i);
  41 
        [numericData, errData, placeholdermask] = matlab.io.internal.text.datatypeConvertFromString(varopts,data(textmaskInd,i));
  42 
        
  43 
        % Assign results back into the larger vectors containing
  44 
        % all data and error ids
  45 
        % Assign durationData after some initial formatting
  46 
        errid(textmaskInd,i) = errData;
  47 
        placeholder(textmaskInd,i) = placeholdermask;
  48 
        var(textmaskInd,i) = numericData;
  49 
    end
< 0.001 
      3 
  50
else 
< 0.001 
      3 
  51
    placeholder = false(size(typeIDs)); 
< 0.001 
      3 
  52
end 
  53 

< 0.001 
      3 
  54
datemask = typeIDs == sheet.DATETIME; 
< 0.001 
      3 
  55
if any(datemask,'all') 
  56 
    data = sheet.readDates(subrange);
  57 
    dates = matlab.io.spreadsheet.internal.createDatetime(data(datemask), 'default', '');
  58 
    var(datemask) = exceltime(dates);
< 0.001 
      3 
  59
end 
  60 

< 0.001 
      3 
  61
boolmask = typeIDs == sheet.BOOLEAN; 
< 0.001 
      3 
  62
if any(boolmask,'all') 
  63 
    data = sheet.readBooleans(subrange);
  64 
    var(boolmask) = data(boolmask);
< 0.001 
      3 
  65
end 
  66 

< 0.001 
      3 
  67
numbermask = typeIDs == sheet.NUMBER; 
< 0.001 
      3 
  68
if any(numbermask,'all') 
< 0.001 
      3 
  69
    data = sheet.readNumbers(subrange); 
< 0.001 
      3 
  70
    var(numbermask) = data(numbermask); 
< 0.001 
      3 
  71
end 
< 0.001 
      3 
  72
var(typeIDs == sheet.BLANK | typeIDs == sheet.EMPTY) = NaN; 
< 0.001 
      3 
  73
end 

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