This is a static copy of a profile report

Home

columnLetter (Calls: 5, Time: 0.001 s)
Generated 04-Jun-2021 04:11:19 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\shared\spreadsheet\+matlab\+io\+spreadsheet\+internal\columnLetter.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...portOptionsSpreadsheet>getCellNameclass method4
...rtOptionsSpreadsheet.getOptsFromSheetclass method1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
for i = digits:-1:3
50.000 s24.2%
48
s = char('A'-1+idx(end:-1:1));
50.000 s17.4%
15
if isempty(powersOf26)
50.000 s15.7%
29
idx = zeros(1,digits);
50.000 s15.2%
14
persistent powersOf26 
50.000 s5.9%
All other lines  0.000 s21.6%
Totals  0.001 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function49
Non-code lines (comments, blank lines)22
Code lines (lines that can run)27
Code lines that did run16
Code lines that did not run11
Coverage (did run/can run)59.26 %
Function listing
time 
Calls 
 line
   1 
function s = columnLetter(d)
   2 
    %   COLUMNLETTER(D) returns the representation of D as a spreadsheet column letter,
   3 
    %   expressed as 'A'..'Z', 'AA','AB'...'AZ', and so on. 
   4 
    %
   5 
    %   Examples:
   6 
    %       dec2base(1) returns 'A'
   7 
    %       dec2base(26) returns 'Z'
   8 
    %       dec2base(27) returns 'AA'
   9 
    %
  10 
    % See also matlab.io.spreadsheet.internal.columnNumber
  11 
    
  12 
    %   Copyright 2014-2016 The MathWorks, Inc.
  13 

< 0.001 
      5 
  14
    persistent powersOf26  
< 0.001 
      5 
  15
    if isempty(powersOf26) 
  16 
        powersOf26 = 26.^(1:11);
< 0.001 
      5 
  17
    end 
  18 
        
< 0.001 
      5 
  19
    digits = 1; 
< 0.001 
      5 
  20
    begin = 0; 
< 0.001 
      5 
  21
    current_sum = 26; 
  22 
    % This calculates the number of "letter-digits" in the output
< 0.001 
      5 
  23
    while d > current_sum 
  24 
        digits = digits + 1;
  25 
        begin = current_sum;
  26 
        current_sum = begin + powersOf26(digits);
  27 
    end
  28 
    
< 0.001 
      5 
  29
    idx = zeros(1,digits); 
< 0.001 
      5 
  30
    pos = d - begin; 
  31 

  32 
    % Find the leftmost "letter-digits" 
< 0.001 
      5 
  33
    for i = digits:-1:3 
  34 
        remainder = rem(pos-1, powersOf26(i-1)) + 1;
  35 
        idx(i) = (pos - remainder)/powersOf26(i-1) + 1;
  36 
        pos = remainder;
  37 
    end
  38 
    
  39 
    % Find the right most "letter-digits"
< 0.001 
      5 
  40
    if digits >= 2 
  41 
        idx(1) = rem(pos-1, 26) + 1;
  42 
        idx(2) = (pos - idx(1))/26 + 1;
< 0.001 
      5 
  43
    else 
< 0.001 
      5 
  44
        idx(1) = pos; 
< 0.001 
      5 
  45
    end 
  46 
    
  47 
    % Write out the reverse digits using char
< 0.001 
      5 
  48
    s = char('A'-1+idx(end:-1:1)); 
< 0.001 
      5 
  49
end 

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