MATLAB Function Reference
  Go to function:
    Search    Help Desk 
fullfile    Examples

Build full filename from parts

Syntax

Description

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].

Example

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.



[ Previous | Help Desk | Next ]