This is a static copy of a profile report

Home

strjust>strjustOnChar (Calls: 56, Time: 0.008 s)
Generated 16-Jul-2020 17:09:46 using performance time.
subfunction in file /Applications/MATLAB_R2020a.app/toolbox/matlab/strfun/strjust.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
strjustfunction56
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
69
[dum,offset] = max(fliplr(ch),...
560.002 s26.6%
85
t(r + (newc-1)*m) = s(r + (c-1...
560.001 s14.4%
83
newc = c + offset(r);
560.001 s9.6%
84
t = repmat(' ',m,n);
560.001 s7.5%
56
if ~any(isspace(s(:,spaceCol))...
560.001 s7.3%
All other lines  0.003 s34.7%
Totals  0.008 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
fliplrfunction560.001 s9.7%
Self time (built-ins, overhead, etc.)  0.008 s90.3%
Totals  0.008 s100% 
Code Analyzer results
Line numberMessage
69The value assigned here to 'dum' appears to be unused. Consider replacing it by ~.
72The value assigned here to 'dum' appears to be unused. Consider replacing it by ~.
75The value assigned here to 'dum' appears to be unused. Consider replacing it by ~.
76The value assigned here to 'dum' appears to be unused. Consider replacing it by ~.
Coverage results
Show coverage for parent directory
Total lines in function49
Non-code lines (comments, blank lines)11
Code lines (lines that can run)38
Code lines that did run23
Code lines that did not run15
Coverage (did run/can run)60.53 %
Function listing
time 
Calls 
 line
  38 
function t = strjustOnChar(s,justify)
  39 

< 0.001 
     56 
  40
    if isempty(s) 
  41 
        t = s; 
  42 
        return;
< 0.001 
     56 
  43
    end 
  44 

< 0.001 
     56 
  45
    [m,n] = size(s); 
  46 

< 0.001 
     56 
  47
    spaceCol = 0; 
< 0.001 
     56 
  48
    switch justify 
< 0.001 
     56 
  49
    case 'right' 
< 0.001 
     56 
  50
        spaceCol = n; 
  51 
    case 'left'
  52 
        spaceCol = 1;
< 0.001 
     56 
  53
    end 
  54 

< 0.001 
     56 
  55
    if spaceCol 
< 0.001 
     56 
  56
        if ~any(isspace(s(:,spaceCol))) 
  57 
            t = char(s);
  58 
            return;
< 0.001 
     56 
  59
        end         
< 0.001 
     56 
  60
    end 
  61 

  62 
    % Find non-pad characters
< 0.001 
     56 
  63
    ch = (s ~= ' ' & s ~= 0); 
< 0.001 
     56 
  64
    [r,c] = find(ch); 
  65 

  66 
    % Determine offset
< 0.001 
     56 
  67
    switch justify 
< 0.001 
     56 
  68
    case 'right' 
  0.002 
     56 
  69
        [dum,offset] = max(fliplr(ch),[],2); 
< 0.001 
     56 
  70
        offset =  offset - 1; 
  71 
    case 'left'
  72 
        [dum,offset] = max(ch,[],2);
  73 
        offset = 1 - offset;
  74 
    case 'center'
  75 
        [dum,offsetR] = max(fliplr(ch),[],2);
  76 
        [dum,offsetL] = max(ch,[],2);
  77 
        offset = floor((offsetR - offsetL)/2);
  78 
    otherwise
  79 
        error(message('MATLAB:strjust:UnknownParameter'));
< 0.001 
     56 
  80
    end 
  81 

  82 
    % Apply offset to justify character array
< 0.001 
     56 
  83
    newc = c + offset(r); 
< 0.001 
     56 
  84
    t = repmat(' ',m,n); 
  0.001 
     56 
  85
    t(r + (newc-1)*m) = s(r + (c-1)*m); 
< 0.001 
     56 
  86
end 

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