Documentation Center

  • Trial Software
  • Product Updates
라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Build full file name from parts


  • f = fullfile(filepart1,...,filepartN) example



f = fullfile(filepart1,...,filepartN) builds a full file specification, f, from the folders and file names specified. fullfile inserts platform-dependent file separators where necessary, and does not add a trailing file separator. The output of fullfile is conceptually equivalent to

f = [filepart1 filesep filepart2 filesep ... filesep filepartN]


expand all

Create a Full File Name

f = fullfile('myfolder','mysubfolder','myfile.m')
f =

fullfile returns a string containing the full path to the file. On Windows® platforms, the file separator character is a backslash, \. On other platforms, the file separator might be a different character.

Create Paths to Multiple Files

f = fullfile(toolboxdir('matlab'),'iofun',{'filesep.m';'fullfile.m'});

fullfile returns a cell array containing a path to the file filesep.m, and a path to the file fullfile.m.

Create a Path to a Folder

f = fullfile(matlabroot,'toolbox','matlab',filesep);

fullfile does not trim a leading or trailing filesep.

Input Arguments

expand all

filepart1,...,filepartN — Folder and file namesstrings | cell arrays of strings

Folder and file names, specified as strings and cell arrays of strings. Any nonscalar cell arrays must be of the same size.

Example: 'folder1','folder2','myfile.m'

Example: {'folder1';'folder2'},{'subfolder1';'subfolder2'},'myfile.m'

See Also

| | | |

Was this topic helpful?