Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

fullfile - Build full file name from parts

Syntax

f = fullfile(folderName1, folderName2, ..., fileName)

Description

f = fullfile(folderName1, folderName2, ..., fileName) builds a full file specification f from the folders and file name specified. Input arguments folderName1, folderName2, etc. and fileName are each strings enclosed in single quotation marks. The output of fullfile is conceptually equivalent to

f = [folderName1 filesep folderName2 filesep ... filesep filename]

except that care is taken to handle the cases when the folders begin or end with a file separator.

Examples

To create the full file name from a disk name, folders, and filename,

f = fullfile('C:', 'Applications', 'matlab', 'myfun.m')
f =
C:\Applications\matlab\myfun.m

The following examples both produce the same result on UNIX[1] platforms, but only the second one works on all platforms.

fullfile(matlabroot, 'toolbox/matlab/general/Contents.m')
fullfile(matlabroot, 'toolbox', 'matlab', 'general', ...
         'Contents.m')

See Also

fileparts, filesep, path, pathsep, genpath


[1] UNIX is a registered trademark of The Open Group in the United States and other countries

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS