| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
f = fullfile(folderName1, folderName2,
..., fileName)
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.
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.mThe 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')fileparts, filesep, path, pathsep, genpath
[1] UNIX is a registered trademark of The Open Group in the United States and other countries
![]() | full | func2str | ![]() |

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 |