This is a static copy of a profile report

Home

fullfile (Calls: 1942, Time: 0.236 s)
Generated 16-Jul-2020 17:08:27 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/iofun/fullfile.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
genpathfunction1930
namefunction12
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
88
theInputs{1} = ensureTrailingF...
19420.049 s20.6%
100
f = refinePath(f,fileSeparator...
19420.046 s19.4%
84
theInputs(cellfun('isempty', t...
19420.029 s12.2%
91
theInputs(2,:) = {fileSeparato...
19420.024 s10.2%
97
f = [theInputs{:}];
19420.018 s7.6%
All other lines  0.071 s30.0%
Totals  0.236 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
fullfile>refinePathsubfunction19420.039 s16.7%
fullfile>ensureTrailingFilesepsubfunction19420.036 s15.2%
Self time (built-ins, overhead, etc.)  0.161 s68.1%
Totals  0.236 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function109
Non-code lines (comments, blank lines)53
Code lines (lines that can run)56
Code lines that did run41
Code lines that did not run15
Coverage (did run/can run)73.21 %
Function listing
time 
Calls 
 line
   1 
function f = fullfile(varargin)
   2 
%FULLFILE Build full file name from parts.
   3 
%   F = fullfile(FOLDERNAME1, FOLDERNAME2, ..., FILENAME) builds a full
   4 
%   file specification F from the folders and file name specified. Input
   5 
%   arguments FOLDERNAME1, FOLDERNAME2, etc. and FILENAME can be strings,
   6 
%   character vectors, or cell arrays of character vectors. Non-scalar
   7 
%   strings and cell arrays of character vectors must all be the same size.
   8 
%
   9 
%   If any input is a string array, F is a string array. Otherwise, if any
  10 
%   input is a cell array, F is a cell array.  Otherwise, F is a character
  11 
%   array.
  12 
%
  13 
%   The output of FULLFILE is conceptually equivalent to character vector
  14 
%   horzcat operation:
  15 
%
  16 
%      F = [FOLDERNAME1 filesep FOLDERNAME2 filesep ... filesep FILENAME]
  17 
%
  18 
%   except that care is taken to handle the cases when the folders begin or
  19 
%   end with a file separator.
  20 
%
  21 
%   FULLFILE collapses inner repeated file separators unless they appear at 
  22 
%   the beginning of the full file specification. FULLFILE also collapses 
  23 
%   relative folders indicated by the dot symbol, unless they appear at 
  24 
%   the end of the full file specification. Relative folders indicated 
  25 
%   by the double-dot symbol are not collapsed.
  26 
%
  27 
%   To split a full file name into folder parts, use split(f, filesep).
  28 
%
  29 
%   Examples
  30 
%     % To build platform dependent paths to files:
  31 
%        fullfile(matlabroot,'toolbox','matlab','general','Contents.m')
  32 
%
  33 
%     % To build platform dependent paths to a folder:
  34 
%        fullfile(matlabroot,'toolbox','matlab',filesep)
  35 
%
  36 
%     % To build a collection of platform dependent paths to files:
  37 
%        fullfile(toolboxdir('matlab'),'iofun',{'filesep.m';'fullfile.m'})
  38 
%
  39 
%   See also FILESEP, PATHSEP, FILEPARTS, GENPATH, PATH, SPLIT.
  40 

  41 
%   Copyright 1984-2018 The MathWorks, Inc.
  42 
    
< 0.001 
   1942 
  43
    narginchk(1, Inf); 
  0.006 
   1942 
  44
    persistent fileSeparator; 
  0.001 
   1942 
  45
    if isempty(fileSeparator) 
  46 
        fileSeparator = filesep;
< 0.001 
   1942 
  47
    end 
  48 

  0.003 
   1942 
  49
    theInputs = varargin; 
  50 

< 0.001 
   1942 
  51
    containsCellOrStringInput = false; 
< 0.001 
   1942 
  52
    containsStringInput = false;  
  53 

< 0.001 
   1942 
  54
    for i = 1:nargin 
  55 

  0.009 
   3884 
  56
        inputElement = theInputs{i}; 
  57 
        
< 0.001 
   3884 
  58
        containsCellOrStringInput = containsCellOrStringInput || iscell(inputElement); 
  59 
        
< 0.001 
   3884 
  60
        if isstring(inputElement) 
  61 
            containsStringInput = true; 
  62 
            containsCellOrStringInput = true; 
  63 
            theInputs{i} = convertStringsToChars(theInputs{i});
< 0.001 
   3884 
  64
        end 
  65 
    
  0.002 
   3884 
  66
        if ~ischar(theInputs{i}) && ~iscell(theInputs{i}) && ~isnumeric(theInputs{i}) && ~isreal(theInputs{i}) 
  67 
            error(message('MATLAB:fullfile:InvalidInputType'));
< 0.001 
   3884 
  68
        end 
  69 

  0.001 
   3884 
  70
    end 
  71 
    
  0.001 
   1942 
  72
    f = theInputs{1}; 
< 0.001 
   1942 
  73
    try 
  0.001 
   1942 
  74
        if nargin == 1 
  75 
            if ~isnumeric(f)
  76 
                f = refinePath(f, fileSeparator);
  77 
            else 
  78 
                f = char(f); 
  79 
            end
< 0.001 
   1942 
  80
        else 
< 0.001 
   1942 
  81
            if containsCellOrStringInput 
  82 
                theInputs(cellfun(@(x)~iscell(x)&&isempty(x), theInputs)) = [];
< 0.001 
   1942 
  83
            else 
  0.029 
   1942 
  84
                theInputs(cellfun('isempty', theInputs)) = ''; 
< 0.001 
   1942 
  85
            end 
  86 

< 0.001 
   1942 
  87
            if length(theInputs)>1 
  0.049 
   1942 
  88
                theInputs{1} = ensureTrailingFilesep(theInputs{1}, fileSeparator); 
< 0.001 
   1942 
  89
            end 
< 0.001 
   1942 
  90
            if ~isempty(theInputs) 
  0.024 
   1942 
  91
                theInputs(2,:) = {fileSeparator}; 
  0.002 
   1942 
  92
                theInputs{2,1} = ''; 
  0.018 
   1942 
  93
                theInputs(end) = ''; 
< 0.001 
   1942 
  94
                if containsCellOrStringInput 
  95 
                    f = strcat(theInputs{:});
< 0.001 
   1942 
  96
                else 
  0.018 
   1942 
  97
                    f = [theInputs{:}]; 
< 0.001 
   1942 
  98
                end 
< 0.001 
   1942 
  99
            end 
  0.046 
   1942 
 100
            f = refinePath(f,fileSeparator); 
  0.001 
   1942 
 101
        end 
 102 
    catch
 103 
        locHandleError(theInputs(1,:));
< 0.001 
   1942 
 104
    end 
 105 
    
< 0.001 
   1942 
 106
    if containsStringInput 
 107 
        f = string(f);
< 0.001 
   1942 
 108
    end 
  0.005 
   1942 
 109
end 

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