| MATLAB Function Reference | Search  Help Desk |
| fullfile | Examples |
Build full filename from parts
fullfile(dir1,dir2, ...,filename)
fullfile(dir1,dir2, ...,filename)
builds a full filename from the directories and filename specified. This is conceptually equivalent to
f = [dir1 dirsep dir2 dirsep ... dirsep filename]
except that care is taken to handle the cases when the directories begin or end with a directory separator. Specify the filename as '' to build a pathname from parts. On VMS, care is taken to handle the cases involving [or].
fullfile(matlabroot,'toolbox/matlab/general/Contents.m') and
fullfile(matlabroot,'toolbox','matlab','general','Contents.m')
produce the same result on UNIX, but only the second one works on all platforms.