| MATLAB Function Reference | ![]() |
f = fullfile(dir1, dir2, ..., filename)
f = fullfile(dir1, dir2, ..., filename) builds a full file specification f from the directories and filename specified. Input arguments dir1, dir2, etc. and filename are each a string enclosed in single quotes. The output of the fullfile command is conceptually equivalent to
f = [dir1 filesep dir2 filesep ... filesep filename]
except that care is taken to handle the cases when the directories begin or end with a directory separator.
To create the full filename from a disk name, directories, and filename,
f = fullfile('C:', 'Applications', 'matlab', 'myfun.m')
f =
C:\Applications\matlab\myfun.mThe following examples both produce the same result on UNIX®, but only the second one works on all platforms. (UNIX is a registered trademark of The Open Group in the United States and other countries).
fullfile(matlabroot, 'toolbox/matlab/general/Contents.m')
fullfile(matlabroot, 'toolbox', 'matlab', 'general', ...
'Contents.m')fileparts, filesep, path, pathsep, genpath
![]() | full | func2str | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |