Skip to content

fullfile

Build a file path from directory and file components.

f = fullfile(dir1, dir2, ..., filename)

Concatenates path parts with the platform-specific separator, removing redundant separators. Inverse of fileparts (without the extension split). Use instead of manual [d filesep f] construction.

fullfile('data', 'raw', 'run.csv')
% 'data/raw/run.csv' (Unix) or 'data\\raw\\run.csv' (Windows)
  • fileparts — Split a file path into its components.
  • filesep — Platform-specific path separator.